/* Base styles */
:root {
    --primary: #2563eb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--gray-700);
    background-color: #fff;
}

/* Site Elevator */
.site-elevator {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.elevator-item {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.elevator-item:hover {
    transform: translateY(-2px);
}

.elevator-item img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Navigation */
.topnav-wrapper {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.topnav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.navbar {
    padding: 0.5rem 0;
}

.navbar-brand {
    white-space: nowrap;
    margin-right: 2rem;
}

.navbar-nav {
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
}

.nav-item {
    flex-shrink: 0;
}

.nav-link {
    color: var(--gray-600);
    font-size: 0.875rem;
    padding: 0.5rem 0.5rem !important;
    font-weight: 500;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.active {
    color: var(--primary) !important;
    font-weight: 600;
}

/* Badge styles for navigation */
.badge-hot, .badge-trial {
    font-size: 0.65rem;
    padding: 2px 4px;
    margin-left: 3px;
    border-radius: 3px;
    vertical-align: middle;
    white-space: nowrap;
    position: relative;
    top: -2px;
    font-weight: 700;
}

.badge-hot {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    animation: pulse-hot 1.5s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.badge-trial {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    animation: pulse-trial 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}

@keyframes pulse-hot {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 15px rgba(239, 68, 68, 0.9), 0 0 25px rgba(239, 68, 68, 0.5);
    }
}

@keyframes pulse-trial {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 15px rgba(59, 130, 246, 0.9), 0 0 25px rgba(59, 130, 246, 0.5);
    }
}

/* Premium upgrade button in nav */
.nav-link.premium-upgrade {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white !important;
    font-weight: 600;
    padding: 8px 20px !important;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    animation: glow 2s ease-in-out infinite;
    font-size: 0.8rem !important;
}

.nav-link.premium-upgrade:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.nav-link.premium-upgrade::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(245, 158, 11, 0.5), 0 0 10px rgba(245, 158, 11, 0.3);
    }
    50% {
        box-shadow: 0 0 10px rgba(245, 158, 11, 0.8), 0 0 20px rgba(245, 158, 11, 0.5), 0 0 30px rgba(245, 158, 11, 0.3);
    }
}

@keyframes shine {
    0% {
        left: -50%;
    }
    100% {
        left: 150%;
    }
}

/* User dropdown */
.nav-link.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link.dropdown-toggle i {
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.testitem-card {
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    border: 1px solid #ccc !important;
    transition: all 0.3s ease !important;
}

.testitem-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
    transform: translateY(-4px) !important;
}

.card-footer .btn-primary {
    background: white;
    color: var(--primary);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.card-footer .btn-primary:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Content Header */
.content-header {
    background-color: var(--gray-100);
    padding: 2rem 0 0 0;
}

.content-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-800);
}

/* Test Exams Navigation */
.test-exams .nav-pills {
    margin: -0.25rem;
}

.test-exams .nav-item {
    padding: 0.25rem;
}

.test-exams .nav-link {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.375rem;
    color: var(--gray-600);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.test-exams .nav-link:hover {
    background-color: var(--gray-100);
}

.test-exams .nav-link.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white !important;
}

.test-exams .dropdown:hover .dropdown-menu {
    display: block;
}

.test-exams .dropdown-menu {
    margin-top: 0.25rem;
}

.test-exams .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.test-exams .dropdown-item:hover {
    background-color: var(--gray-100);
}

/* Search Form */
.form-control {
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    text-align: left;
    appearance: none;
    background-image: none;
    display: block;
    width: 100%;
    height: 2.75rem;
    line-height: 1.5;
}

select.form-control {
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    appearance: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-section label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    display: block;
}

/* Nav Tabs */
.nav-tabs {
    border-bottom: 1px solid var(--gray-200);
}

.nav-tabs .nav-link {
    color: var(--gray-600);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.75rem 1rem;
    margin-bottom: -1px;
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* Test Items Grid */
.testitem-grid {
    margin: 0 -0.75rem;
    padding-top: 1.5rem;
}

.testitem-wrapper {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.25rem;
    height: 100%;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.testitem-wrapper:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    border-color: var(--gray-300);
    transform: translateY(-2px);
}

.testitem-title {
    font-size: 1rem;
    font-weight: 600;
    color: #000;
    margin-bottom: 1rem;
}

.testitem-title a {
    color: #000;
    text-decoration: none;
}

.testitem-title a:hover {
    color: var(--primary);
}

.testitem-info {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.testitem-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

/* Sidebar */
.sidebar-banner-item {
    display: block;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: transform 0.2s;
}

.sidebar-banner-item:hover {
    transform: translateY(-2px);
}

/* Test Detail Page */
.test-detail-wrapper {
    background-color: #fff;
    padding: 2rem 0;
}

.breadcrumb-section {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.breadcrumb-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: #1e40af;
    text-decoration: underline;
}

.test-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0;
}

.test-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.test-info {
    background-color: var(--gray-50);
    padding: 1.5rem;
    border-radius: 0.5rem;
}

.info-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    color: var(--gray-600);
    font-weight: 500;
    min-width: 150px;
}

.info-value {
    color: var(--gray-800);
    font-weight: 600;
}

.test-tabs .nav-link {
    color: var(--gray-600);
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1rem;
    transition: all 0.2s;
}

.test-tabs .nav-link:hover {
    border-bottom-color: var(--primary);
}

.test-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.practice-section,
.full-test-section,
.comments-section {
    padding: 1.5rem;
    background-color: var(--gray-50);
    border-radius: 0.5rem;
}

.practice-part {
    padding: 1rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.practice-part:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    margin: 0;
}

.custom-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.part-name {
    font-weight: 500;
    color: var(--gray-800);
    flex: 1;
}

.part-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Sidebar Widgets */
.sidebar-widget {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: all 0.3s;
}

.sidebar-widget:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.widget-header {
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
    padding: 1rem 1.25rem;
    color: white;
    border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

.widget-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.widget-header i {
    font-size: 1.125rem;
}

.widget-body {
    padding: 0;
}

/* Ranking List */
.ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    transition: all 0.2s;
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item:hover {
    background-color: var(--gray-50);
    transform: translateX(4px);
}

.rank-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
    background-color: var(--gray-200);
    color: var(--gray-700);
}

/* Medal Colors for Top 3 */
.rank-1 .rank-number {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    font-size: 1rem;
}

.rank-2 .rank-number {
    background: linear-gradient(135deg, #E8E8E8 0%, #C0C0C0 100%);
    color: #555;
    box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
    font-size: 1rem;
}

.rank-3 .rank-number {
    background: linear-gradient(135deg, #F4A460 0%, #CD7F32 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
    font-size: 1rem;
}

.rank-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.rank-name {
    font-weight: 500;
    color: var(--gray-800);
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.rank-1 .rank-name,
.rank-2 .rank-name,
.rank-3 .rank-name {
    font-weight: 600;
}

.rank-score {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.875rem;
    white-space: nowrap;
}

.rank-1 .rank-score {
    color: #FF8C00;
    font-size: 0.9375rem;
}

.rank-2 .rank-score {
    color: #808080;
    font-size: 0.9375rem;
}

.rank-3 .rank-score {
    color: #B8860B;
    font-size: 0.9375rem;
}

/* View All Link */
.view-all-link {
    display: block;
    text-align: center;
    padding: 0.875rem 1.25rem;
    background-color: var(--gray-50);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    border-top: 1px solid var(--gray-100);
    transition: all 0.2s;
}

.view-all-link:hover {
    background-color: var(--primary);
    color: white;
    text-decoration: none;
}

.view-all-link i {
    margin-left: 0.25rem;
    font-size: 0.75rem;
}

/* Time Selection Box */
.time-selection-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6 !important;
    transition: all 0.3s ease;
}

.time-selection-box:hover {
    border-color: var(--primary) !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.time-selection-box h5 {
    color: var(--gray-800);
    font-weight: 600;
}

.time-selection-box select {
    border: 2px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    height: 2.75rem;
    line-height: 1.5;
    transition: all 0.2s;
}

.time-selection-box select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

.time-selection-box button {
    transition: all 0.3s ease;
    font-weight: 600;
    padding: 0.75rem 2rem;
    font-size: 1.0625rem;
}

.time-selection-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Responsive */
@media (max-width: 1200px) {
    .topnav-container {
        padding: 0 0.25rem;
    }
    
    .navbar-brand {
        margin-right: 0.25rem;
    }
    
    .nav-link {
        font-size: 0.8125rem;
        padding: 0.4rem 0.4rem !important;
    }
    
    .nav-link.premium-upgrade {
        font-size: 0.75rem !important;
        padding: 0.35rem 0.5rem !important;
    }
    
    .badge-hot, .badge-trial {
        font-size: 0.6rem;
        padding: 1px 3px;
    }
}

@media (max-width: 768px) {
    .content-header {
        padding: 1.5rem 0;
    }

    .content-header h1 {
        font-size: 1.5rem;
    }

    .nav-link {
        padding: 0.5rem;
    }

    .testitem-grid {
        margin: 0 -0.5rem;
    }

    /* Sidebar becomes full width on mobile */
    .sidebar-widget {
        margin-bottom: 1rem;
    }

    .widget-header {
        padding: 0.875rem 1rem;
    }

    .widget-header h5 {
        font-size: 0.9375rem;
    }

    .ranking-item {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    .rank-number {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.8125rem;
    }

    .rank-1 .rank-number,
    .rank-2 .rank-number,
    .rank-3 .rank-number {
        font-size: 0.875rem;
    }

    .rank-name {
        font-size: 0.875rem;
    }

    .rank-score {
        font-size: 0.8125rem;
    }

    .view-all-link {
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
    }
}
