/* ===================================
   基本設定
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1A3A5C;
    --secondary-color: #2C5F8D;
    --accent-color: #4A7BA7;
    --success-color: #3A7D5C;
    --warning-color: #D4841C;
    --danger-color: #C64545;
    --text-dark: #1A2332;
    --text-light: #5A6C7D;
    --bg-light: #F4F6F8;
    --bg-white: #FFFFFF;
    --bg-navy: #0F2537;
    --border-color: #D1D9E0;
    --shadow-sm: 0 2px 4px rgba(26, 58, 92, 0.1);
    --shadow-md: 0 4px 12px rgba(26, 58, 92, 0.15);
    --shadow-lg: 0 8px 24px rgba(26, 58, 92, 0.2);
}

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-dark);
    background: linear-gradient(to bottom, #F4F6F8 0%, #E8EEF2 100%);
    line-height: 1.8;
    font-size: 16px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===================================
   ヘッダー
   =================================== */
.header {
    background: linear-gradient(135deg, var(--bg-navy), var(--primary-color));
    color: white;
    padding: 40px 0;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.header-left {
    flex-shrink: 0;
}

.header-logo {
    max-width: 180px;
    height: auto;
    display: block;
}

.header-right {
    flex: 1;
    text-align: left;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.subtitle {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 6px;
    opacity: 0.95;
}

.tagline {
    font-size: 0.9rem;
    opacity: 0.85;
    font-weight: 300;
}

.instructor-login-btn {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instructor-login-btn:hover {
    background: white;
    color: var(--primary-color);
}

.instructor-login-btn i {
    font-size: 1rem;
}

/* ===================================
   フィルターバー
   =================================== */
.filter-section {
    margin-bottom: 30px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--bg-white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-dark);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-btn i {
    margin-right: 6px;
}

/* ===================================
   カード
   =================================== */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 2rem;
}

/* ===================================
   ボタン
   =================================== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 14px 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-danger:hover {
    background: #B03C3C;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ===================================
   質問カード
   =================================== */
.consultation-item {
    border-left: 4px solid var(--accent-color);
    padding: 1.5rem;
    background: #f8fafc;
    margin-bottom: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.consultation-item:hover {
    background: #e2e8f0;
    transform: translateX(5px);
}

/* ===================================
   バッジ
   =================================== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-unanswered {
    background: #fef3c7;
    color: #92400e;
}

.badge-answered {
    background: #d1fae5;
    color: #065f46;
}

.badge-pending {
    background: #dbeafe;
    color: #1e40af;
}

.badge-primary {
    background: var(--primary-color);
    color: white;
}

.category-filter {
    cursor: pointer;
    transition: all 0.3s;
    background: #e2e8f0;
    color: #475569;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: none;
    font-weight: 500;
}

.category-filter:hover {
    background: #cbd5e1;
    transform: scale(1.05);
}

.category-filter.active {
    background: var(--primary-color);
    color: white;
}

/* ===================================
   ロックされたコンテンツ
   =================================== */
.locked-content {
    filter: blur(5px);
    user-select: none;
    pointer-events: none;
}

/* ===================================
   モーダル
   =================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 2rem 2rem 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem 2rem;
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Noto Sans JP', sans-serif;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 58, 92, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group .error {
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.form-group .char-count {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

/* ===================================
   レスポンシブデザイン
   =================================== */
@media (max-width: 768px) {
    .header {
        padding: 30px 0;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
        position: relative;
    }

    .header-right {
        text-align: center;
    }

    .instructor-login-btn {
        position: static;
        margin-top: 0;
        transform: none;
    }
    
    /* ヘッダーの認証ボタンをスマホで調整 */
    #headerAuthButtons {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem !important;
    }
    
    #headerAuthButtons button {
        width: 100%;
        justify-content: center;
    }

    .header-logo {
        max-width: 150px;
    }

    .logo {
        font-size: 1.5rem;
        line-height: 1.4;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .card {
        padding: 1.5rem;
    }
    
    .consultation-item {
        padding: 1rem;
    }
}

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

    .header-logo {
        max-width: 120px;
    }

    .logo {
        font-size: 1.2rem;
        line-height: 1.5;
    }

    .subtitle {
        font-size: 1rem;
    }
    
    .tagline {
        font-size: 0.85rem;
    }
    
    /* スマホでのボタン配置 */
    .header-content > div:last-child {
        width: 100%;
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    #headerAuthButtons {
        width: 100%;
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    #headerAuthButtons button,
    #instructorLoginBtn {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.75rem 1.5rem !important;
        font-size: 0.95rem !important;
    }
}

/* ===================================
   Admin Filter Buttons
   =================================== */
.filter-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--border-color);
    background: white;
    color: var(--text-dark);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    background: var(--bg-light);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-btn i {
    font-size: 1rem;
}

/* Tab buttons for admin dashboard */
.tab-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(26, 58, 92, 0.05);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* ===================================
   いいね・ブックマークボタン
   =================================== */
#like-btn-${consultation.id},
#bookmark-btn-${consultation.id},
.btn-like,
.btn-bookmark {
    transition: all 0.3s ease;
}

.btn-like.liked,
button.liked {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border-color: #dc2626 !important;
}

.btn-like.liked i,
button.liked i {
    color: #dc2626 !important;
}

.btn-bookmark.bookmarked,
button.bookmarked {
    background: #fef3c7 !important;
    color: #d97706 !important;
    border-color: #d97706 !important;
}

.btn-bookmark.bookmarked i,
button.bookmarked i {
    color: #d97706 !important;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* アニメーション用 */
.btn-like:active,
.btn-bookmark:active {
    transform: scale(0.95);
}
