/* ========== Base Styles ========== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.3);
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
    height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: "Cairo", sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-attachment: fixed;
    padding-bottom: 80px; /* Space for fixed footer */
    margin: 0;
}

/* ========== Animated Background ========== */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.animated-bg::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(17, 153, 142, 0.1) 0%, transparent 40%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-20px, -20px) rotate(5deg); }
    66% { transform: translate(20px, -10px) rotate(-5deg); }
}

/* ========== Header & Navigation ========== */
.navbar {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border) !important;
    box-shadow: 0 4px 30px var(--shadow-color);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== Main Container ========== */
.main-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ========== Hero Section ========== */
.hero-section {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 1rem;
}

.hero-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 15px 50px rgba(102, 126, 234, 0.6); }
}

.hero-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, #a8edea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.4rem;
    margin-top: 1.0rem !important;
    margin-bottom: 2rem !important;
}

/* ========== Promo CTA ========== */
.promo-cta {
    margin-top: .75rem;
}

.promo-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem 1rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(220, 53, 69, .12), rgba(255, 193, 7, .18));
    border: 1px solid rgba(220, 53, 69, .25);
    color: #dc3545;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(220, 53, 69, .14);
    position: relative;
    overflow: hidden;
    animation: promo-bounce 2.4s ease-in-out infinite, promo-glow 2s ease-in-out infinite, promo-pulse 2s ease-in-out infinite;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.promo-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, .55) 50%, transparent 80%);
    transform: translateX(-120%);
    animation: promo-shine 3.2s ease-in-out infinite;
}

@keyframes promo-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 10px 24px rgba(220, 53, 69, .14); }
    50% { transform: scale(1.03); box-shadow: 0 16px 40px rgba(220, 53, 69, .18); }
}

.promo-link:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 14px 28px rgba(220, 53, 69, .22);
}

.promo-link > * {
    position: relative;
    z-index: 1;
}

/* ========== Search Card ========== */
.search-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.search-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px var(--shadow-color);
}

/* ========== Form Styles ========== */
.form-floating {
    margin-bottom: 1.25rem;
}

.form-floating > .form-control,
.form-floating > .form-select {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    height: 60px;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    color: #fff;
    transition: all 0.3s ease;
}

.form-floating > .form-control:focus,
.form-floating > .form-select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

.form-floating > label {
    padding: 1rem 1.25rem;
    color: rgba(255, 255, 255, 0.6);
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
    color: #667eea;
    transform: scale(0.85) translateY(-0.75rem) translateX(0.15rem);
}

.form-select option {
    background: #1a1a2e;
    color: #fff;
}

/* ========== Submit Button ========== */
.btn-search {
    width: 100%;
    height: 56px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-search::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-search:hover::before {
    left: 100%;
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-search:active {
    transform: translateY(0);
}

.btn-search:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ========== Result Card ========== */
.result-container {
    margin-top: 2rem;
}

.result-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    overflow: hidden;
    animation: slideUp 0.5s ease;
}

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

.result-header {
    background: var(--primary-gradient);
    padding: 1.5rem;
    text-align: center;
}

.result-header .student-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.25rem;
}

.result-header .seat-number {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #fff;
}

.result-header .institute-name {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
}

.result-warning {
    background: rgba(255, 193, 7, 0.15);
    border-right: 4px solid #ffc107;
    padding: 0.75rem 1rem;
    margin: 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #ffc107;
}

.result-body {
    padding: 1rem;
}

/* ========== Marks Table ========== */
.marks-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

.marks-table tr {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.marks-table tr:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.01);
}

.marks-table td {
    padding: 1rem 1.25rem;
}

.marks-table td:first-child {
    border-radius: 0 12px 12px 0;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    width: 40%;
}

.marks-table td:last-child {
    border-radius: 12px 0 0 12px;
    font-weight: 700;
    color: #fff;
    text-align: left;
}

.marks-table .result-row {
    background: rgba(102, 126, 234, 0.2) !important;
}

.marks-table .result-row td {
    font-size: 1.1rem;
}

.result-pass {
    color: #38ef7d !important;
}

.result-fail {
    color: #ff4b2b !important;
}

/* ========== Final Result Badge ========== */
.final-result {
    text-align: center;
    padding: 1.5rem;
    margin: 1rem;
    border-radius: 16px;
}

.final-result.pass {
    background: linear-gradient(135deg, rgba(17, 153, 142, 0.2) 0%, rgba(56, 239, 125, 0.2) 100%);
    border: 2px solid rgba(56, 239, 125, 0.3);
}

.final-result.fail {
    background: linear-gradient(135deg, rgba(255, 65, 108, 0.2) 0%, rgba(255, 75, 43, 0.2) 100%);
    border: 2px solid rgba(255, 75, 43, 0.3);
}

.final-result-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.final-result-text {
    font-size: 1.5rem;
    font-weight: 800;
}

.final-result.pass .final-result-text {
    color: #38ef7d;
}

.final-result.fail .final-result-text {
    color: #ff4b2b;
}

/* ========== Loading Spinner ========== */
.loading-container {
    text-align: center;
    padding: 3rem;
}

.custom-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
}

/* ========== Alert Styles ========== */
.custom-alert {
    padding: 1.25rem;
    border-radius: 16px;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.custom-alert.alert-danger {
    background: rgba(255, 75, 43, 0.15);
    border: 1px solid rgba(255, 75, 43, 0.3);
    color: #ff6b6b;
}

.custom-alert.alert-warning {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.custom-alert.alert-info {
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: #a8b4f0;
}

/* ========== Countdown Timer ========== */
.countdown-container {
    text-align: center;
    padding: 2rem;
}

.countdown-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.countdown-timer {
    font-size: 3rem;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    background: var(--danger-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 4px;
}

.countdown-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* ========== Footer ========== */
.footer {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--card-border) !important;
}

.footer a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #a8b4f0;
}

/* ========== Responsive ========== */
@media (max-width: 576px) {
    .hero-icon {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }
    
    .hero-title {
        font-size: 1.4rem;
    }
    
    .search-card {
        padding: 1.5rem;
        border-radius: 20px;
    }
    
    .result-header .student-name {
        font-size: 1.25rem;
    }
    
    .marks-table td {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .final-result-text {
        font-size: 1.25rem;
    }
    
    .countdown-timer {
        font-size: 2.5rem;
    }
}

/* ========== Utility Classes ========== */
.fit {
    width: 1px !important;
    white-space: nowrap !important;
}
