/* リセットと基本スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* コンテナ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ヘッダー */
header {
    background: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
}

header nav a {
    color: white;
    text-decoration: none;
    margin-left: 1.5rem;
    transition: opacity 0.3s;
}

header nav a:hover {
    opacity: 0.8;
}

/* 管理者ヘッダー */
.admin-header {
    background: #34495e;
}

.admin-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-header nav a {
    margin-left: 0;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* メインコンテンツ */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* アラート */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.alert-error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

/* ログインフォーム */
.login-form {
    max-width: 400px;
    margin: 2rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.login-form h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* フォーム */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input[type="file"] {
    padding: 0.5rem;
}

.form-group textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.help-text {
    font-size: 0.875rem;
    color: #777;
    margin-top: 0.25rem;
}

/* ボタン */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #3498db;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.btn:hover {
    background: #2980b9;
}

.btn-primary {
    background: #3498db;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-download {
    background: #27ae60;
}

.btn-download:hover {
    background: #229954;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

/* 記事一覧 */
.tag-filter {
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-label {
    font-weight: 600;
    margin-right: 1rem;
    color: #555;
}

.tag {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    margin: 0.25rem;
    background: #ecf0f1;
    color: #555;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: background 0.3s;
}

.tag:hover,
.tag.active {
    background: #3498db;
    color: white;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.article-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #ecf0f1;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-body {
    padding: 1.5rem;
}

.card-body h3 {
    margin-bottom: 0.75rem;
    color: #2c3e50;
    font-size: 1.25rem;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #777;
}

.card-body .tags {
    margin-bottom: 1rem;
}

.card-body .btn {
    width: 100%;
    text-align: center;
}

/* 記事詳細 */
.article-detail {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: #3498db;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.article-image {
    width: 100%;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
}

.article-image img {
    width: 100%;
    height: auto;
    display: block;
}

.article-detail h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 2rem;
}

.article-meta {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.article-meta .date {
    color: #777;
    font-size: 0.875rem;
}

.article-meta .tags {
    margin-top: 0.5rem;
}

.article-content {
    margin-bottom: 2rem;
    line-height: 1.8;
}

.article-content p {
    margin-bottom: 1rem;
}

.article-content h3 {
    margin: 1.5rem 0 1rem;
    color: #2c3e50;
}

/* ダウンロードセクション */
.download-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.download-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.file-info {
    flex: 1;
}

.file-name {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.file-size {
    font-size: 0.875rem;
    color: #777;
}

/* 管理者テーブル */
.admin-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 1rem;
}

.admin-table thead {
    background: #34495e;
    color: white;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
}

.admin-table tbody tr {
    border-bottom: 1px solid #eee;
}

.admin-table tbody tr:hover {
    background: #f8f9fa;
}

.admin-table .actions {
    white-space: nowrap;
}

.admin-table .actions form {
    margin-left: 0.5rem;
}

/* 記事フォーム */
.article-form {
    max-width: 800px;
    margin: 1rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.current-image {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.current-image img {
    display: block;
    margin-bottom: 0.5rem;
}

.current-image p {
    font-size: 0.875rem;
    color: #777;
}

.current-files {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.current-files .file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
}

/* パスワードフォーム */
.password-form {
    max-width: 500px;
    margin: 1rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.info-box {
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: #e8f4f8;
    border-left: 4px solid #3498db;
    border-radius: 4px;
}

.info-box p {
    margin-bottom: 0.5rem;
}

.info-box p:last-child {
    margin-bottom: 0;
}

/* メッセージ */
.no-articles {
    text-align: center;
    padding: 3rem;
    color: #777;
    background: white;
    border-radius: 8px;
}

/* フッター */
footer {
    background: #2c3e50;
    color: white;
    padding: 1.5rem 0;
    margin-top: 3rem;
    text-align: center;
}

/* レスポンシブ */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        text-align: center;
    }

    header nav {
        margin-top: 1rem;
    }

    header nav a {
        margin: 0 0.5rem;
    }

    .admin-header nav {
        justify-content: center;
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .file-item .btn {
        width: 100%;
        text-align: center;
    }

    .admin-table {
        font-size: 0.875rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.75rem 0.5rem;
    }

    .card-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tag-filter {
        text-align: center;
    }

    .filter-label {
        display: block;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .article-detail,
    .article-form,
    .password-form {
        padding: 1.5rem;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .article-detail h2 {
        font-size: 1.5rem;
    }
}
