/* ========================================
   CompeteBG — Main Site Styles
   ======================================== */

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --success: #10b981;
    --danger: #ef4444;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

a { text-decoration: none; color: inherit; }

/* ========================================
   NAVBAR
   ======================================== */
.site-navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    gap: 1rem;
}

.navbar-brand-custom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.navbar-brand-custom i {
    color: var(--accent);
    font-size: 1.5rem;
}

.navbar-brand-custom strong {
    color: var(--primary-dark);
}

.navbar-links {
    display: flex;
    gap: 0.25rem;
}

.nav-link-custom {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-link-custom:hover {
    color: var(--primary);
    background: #f1f5f9;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-nav {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    background: none;
    color: var(--text-secondary);
}

.btn-login {
    color: var(--primary);
}

.btn-login:hover {
    background: #eef2ff;
    color: var(--primary-dark);
}

.btn-register {
    background: var(--primary);
    color: white !important;
    border-radius: var(--radius-sm);
}

.btn-register:hover {
    background: var(--primary-dark);
    color: white !important;
}

.btn-admin {
    background: #fef3c7;
    color: #92400e;
}

.btn-admin:hover {
    background: #fde68a;
}

.btn-user {
    color: var(--text);
}

.mobile-menu-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text);
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu {
    display: none;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
}

.mobile-menu.show { display: block; }

.mobile-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text);
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.mobile-link:hover {
    background: #f1f5f9;
    color: var(--primary);
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero-section {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #6366f1 100%);
    padding: 3.5rem 0 3rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.text-accent {
    color: var(--accent-light);
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    font-weight: 400;
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 50px;
    padding: 0.35rem 0.35rem 0.35rem 1.25rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    max-width: 600px;
    margin: 0 auto 1.25rem;
}

.search-icon {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--text);
    background: transparent;
    min-width: 0;
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--primary-dark);
}

/* Filters */
.filters-row {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 01.708 0L8 10.293l5.646-5.647a.5.5 0 01.708.708l-6 6a.5.5 0 01-.708 0l-6-6a.5.5 0 010-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    transition: all 0.2s;
}

.filter-select:hover {
    background-color: rgba(255,255,255,0.25);
}

.filter-select:focus {
    outline: none;
    border-color: rgba(255,255,255,0.5);
}

.filter-select option {
    color: var(--text);
    background: white;
}

.filter-clear {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.3);
    transition: all 0.2s;
}

.filter-clear:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* ========================================
   FEATURED SECTION
   ======================================== */
.featured-section {
    padding: 2.5rem 0 1rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text);
}

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

.featured-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
    color: inherit;
    text-decoration: none;
}

.featured-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    color: inherit;
}

.featured-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.featured-card:hover .featured-image img {
    transform: scale(1.05);
}

.featured-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
    font-size: 3rem;
}

.featured-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 0.75rem;
}

.featured-badge {
    background: rgba(245, 158, 11, 0.9);
    color: white;
    padding: 0.3rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.featured-body {
    padding: 1.25rem;
}

.comp-subject {
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
}

.featured-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    color: var(--text);
}

.comp-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* ========================================
   COMPETITION FEED GRID
   ======================================== */
.feed-section {
    padding: 2rem 0 3rem;
}

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

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

.competition-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
    border: 1px solid var(--border);
}

.competition-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    color: inherit;
    border-color: var(--primary-light);
}

.card-image {
    position: relative;
    height: 180px;
    overflow: hidden;
    background: #f1f5f9;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.competition-card:hover .card-image img {
    transform: scale(1.05);
}

.card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: var(--primary);
}

.card-badge {
    position: absolute;
    top: 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    color: white;
}

.badge-free {
    right: 0.75rem;
    background: var(--success);
}

.badge-online {
    left: 0.75rem;
    background: var(--primary);
}

.card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-subject {
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.35;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer-info {
    margin-top: auto;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.75rem;
}

.card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.meta-item i {
    color: var(--text-light);
    margin-right: 0.25rem;
}

.card-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.grade-tag {
    background: #eef2ff;
    color: var(--primary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.status-tag {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.status-tag.open {
    background: #d1fae5;
    color: #065f46;
}

.status-tag.upcoming {
    background: #fef3c7;
    color: #92400e;
}

.status-tag.past {
    background: #f1f5f9;
    color: #64748b;
}

/* ========================================
   PAGINATION
   ======================================== */
.pagination-nav {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.pagination .page-link {
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    margin: 0 0.15rem;
    font-weight: 500;
    transition: all 0.2s;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    color: white;
}

.pagination .page-link:hover {
    background: #eef2ff;
    color: var(--primary);
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
}

.empty-state i {
    color: var(--text-light);
}

.empty-state h3 {
    font-weight: 600;
    color: var(--text);
}

/* ========================================
   COMPETITION DETAIL PAGE
   ======================================== */
.competition-detail {
    padding: 1.5rem 0 3rem;
}

.detail-breadcrumb {
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.detail-breadcrumb a {
    color: var(--primary);
    font-weight: 500;
}

.detail-breadcrumb a:hover {
    text-decoration: underline;
}

.detail-gallery {
    margin-bottom: 1.5rem;
}

.main-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.gallery-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.gallery-thumb.active,
.gallery-thumb:hover {
    opacity: 1;
    border-color: var(--primary);
}

.detail-hero-placeholder {
    width: 100%;
    height: 300px;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.detail-header {
    margin-bottom: 2rem;
}

.detail-subject {
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.detail-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text);
}

.detail-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.detail-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.detail-meta i {
    color: var(--primary);
    margin-right: 0.35rem;
}

.detail-description {
    margin-bottom: 2rem;
}

.section-subtitle {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.description-content {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text);
}

/* Sidebar Cards */
.detail-sidebar-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.action-card {
    border-top: 3px solid var(--primary);
}

.registration-status {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.registration-status.open { color: var(--success); }
.registration-status.upcoming { color: var(--accent); }
.registration-status.closed { color: var(--text-light); }

.detail-info-list {
    margin-top: 1.25rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f8fafc;
}

.info-item:last-child { border-bottom: none; }

.info-item i {
    color: var(--primary);
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.info-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.sidebar-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.organizer-name {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.organizer-link {
    display: block;
    color: var(--primary);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.organizer-link:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

.share-btn {
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.share-btn:hover {
    background: #e2e8f0;
    color: var(--text);
}

/* ========================================
   FOOTER
   ======================================== */
.site-footer {
    background: var(--text);
    color: rgba(255,255,255,0.7);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-brand span {
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
}

.footer-brand p {
    font-size: 0.8rem;
    margin: 0.25rem 0 0;
    opacity: 0.6;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: white;
}

.footer-copy {
    font-size: 0.8rem;
    opacity: 0.5;
    width: 100%;
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .hero-section {
        padding: 2.5rem 0 2rem;
    }

    .search-bar {
        flex-direction: column;
        border-radius: var(--radius);
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .search-icon { display: none; }

    .search-input {
        padding: 0.75rem;
        font-size: 1rem;
    }

    .search-btn {
        width: 100%;
        padding: 0.75rem;
        border-radius: var(--radius-sm);
    }

    .filters-row {
        gap: 0.5rem;
    }

    .filter-select {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
        padding-right: 1.75rem;
    }

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

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

    .detail-title {
        font-size: 1.5rem;
    }

    .main-image {
        height: 250px;
    }

    .detail-meta-row {
        gap: 0.75rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .competitions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   UTILITIES & OVERRIDES
   ======================================== */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

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

.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.25);
}

.form-control:focus {
    border-color: var(--primary-light);
}
