/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #1f2937;
    --light-color: #f3f4f6;
    --white: #ffffff;
    --text-color: #374151;
    --border-color: #d1d5db;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-color);
}

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

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    height: 50px;
    width: 50px;
    object-fit: contain;
}

.school-name {
    font-size: 1.2rem;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    gap: 20px;
}

.nav-menu a {
    color: var(--white);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    transition: background 0.3s;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.2);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    margin: 20px auto;
    max-width: 1200px;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 4rem 0;
    text-align: center;
    border-radius: 10px;
    margin: 20px;
}

.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.subtitle {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.location {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    text-align: center;
}

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

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

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

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

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-lg {
    padding: 15px 30px;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Features Section */
.features {
    padding: 4rem 0;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
    color: var(--dark-color);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}

.feature-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

/* Login Section */
.login-section {
    padding: 4rem 0;
    background: var(--white);
}

.login-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.login-card {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: all 0.3s;
}

.login-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
}

.login-icon {
    font-size: 3.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.login-card h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.login-card p {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

/* Forms */
.form-container {
    max-width: 500px;
    margin: 2rem auto;
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

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

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

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

select.form-control {
    cursor: pointer;
}

/* Tables */
.table-container {
    background: var(--white);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background: var(--light-color);
}

/* Dashboard */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    font-size: 3rem;
    color: var(--primary-color);
}

.stat-info h3 {
    font-size: 2rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.stat-info p {
    color: var(--text-color);
}

.dashboard-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.menu-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s;
    text-decoration: none;
    color: var(--text-color);
}

.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}

.menu-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Result Display */
.result-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.result-header {
    text-align: center;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    width: 100%;
}

.result-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.result-saraswati {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.header-text {
    text-align: center;
    flex: 1;
}

.result-header h1 {
    color: var(--danger-color);
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.student-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 2rem;
    row-gap: 0.5rem;
    margin-bottom: 2rem;
}

.info-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    column-gap: 8px;
    align-items: baseline;
    min-width: 0;
}

.info-label {
    font-weight: 600;
    color: var(--dark-color);
}

.marks-table {
    margin-bottom: 2rem;
}

.marks-table h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.total-section {
    background: var(--light-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 2rem;
}

.total-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.total-item {
    text-align: center;
}

.total-item h4 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.total-item p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Footer */
.footer {
    background: var(--dark-color);
    color: var(--white);
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
}

.footer-section p, .footer-section a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
}

.footer-section a:hover {
    color: var(--white);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* ==================== MODERN NAVIGATION ==================== */
.modern-navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
    text-decoration: none;
}

.nav-logo {
    height: 50px;
    width: 50px;
    object-fit: contain;
    border-radius: 8px;
    background: white;
    padding: 5px;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.school-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: white;
}

.school-subtitle {
    font-size: 0.75rem;
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
    transition: background 0.3s;
}

.mobile-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
}

.nav-link i {
    font-size: 1.1rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.nav-link.nav-logout {
    background: rgba(239, 68, 68, 0.2);
    margin-left: 0.5rem;
}

.nav-link.nav-logout:hover {
    background: rgba(239, 68, 68, 0.4);
}

/* Dropdown Styles */
.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-toggle .fa-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.3s;
}

.nav-dropdown.active .fa-chevron-down {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    overflow: hidden;
}

.nav-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.dropdown-menu a i {
    width: 20px;
    text-align: center;
    color: var(--primary-color);
}

.dropdown-menu a:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, transparent 100%);
    border-left-color: var(--primary-color);
    padding-left: 1.5rem;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.5rem;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: all 0.3s ease;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }
    
    .nav-menu.active {
        max-height: 600px;
        opacity: 1;
    }
    
    .nav-link {
        width: 100%;
        justify-content: flex-start;
    }
    
    .nav-dropdown {
        width: 100%;
    }
    
    .dropdown-menu {
        position: static;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.1);
        margin-top: 0.5rem;
        border-radius: 8px;
    }
    
    .dropdown-menu a {
        color: white;
        border-left-color: rgba(255, 255, 255, 0.3);
    }
    
    .dropdown-menu a i {
        color: white;
    }
    
    .dropdown-menu a:hover {
        background: rgba(255, 255, 255, 0.1);
        border-left-color: white;
    }
    
    .school-name {
        font-size: 1.2rem;
    }
    
    .school-subtitle {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .nav-logo {
        height: 40px;
        width: 40px;
    }
    
    .school-name {
        font-size: 1rem;
    }
    
    .brand-text {
        gap: 0;
    }
}

/* Print Styles */
@media print {
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    @page {
        size: A4 portrait;
        margin: 8mm;
    }

    html, body {
        width: 210mm;
    }

    .modern-navbar, .navbar, .footer, .btn, .no-print {
        display: none !important;
    }

    body {
        background: white;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 12pt;
    }

    .container {
        max-width: none !important;
        width: calc(210mm - 16mm);
        padding: 0 !important;
        margin: 0 auto !important;
    }

    #resultsContainer, #resultsContent {
        width: calc(210mm - 16mm);
        margin: 0 auto !important;
    }

    .main-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    .result-card {
        box-shadow: none;
        border: 1.5px solid #000;
        border-top: 1.5px solid #000;
        padding: 6px;
        width: calc(210mm - 16mm) !important;
        max-width: none !important;
        border-radius: 0 !important;
        transform: none !important;
        page-break-inside: avoid;
        break-inside: avoid;
        page-break-after: always;
        break-after: page;
        margin: 0 auto;
    }

    .result-card:last-child {
        page-break-after: auto;
        break-after: auto;
    }

    .result-header {
        text-align: center;
        margin-bottom: 5px;
        padding-bottom: 3px;
        border-bottom: 0;
    }

    .header-inner {
        display: flex;
        align-items: center;
        gap: 8px;
        justify-content: space-between;
        width: 100%;
    }

    .result-logo {
        width: 18mm;
        height: auto;
        object-fit: contain;
    }

    .result-saraswati {
        width: 18mm;
        height: auto;
        object-fit: contain;
    }

    .header-text h1 {
        color: #ef4444;
        font-weight: 800;
    }

    .result-header .session-name {
        color: #2563eb;
        font-weight: 600;
    }

    .result-header h1 {
        font-size: 18pt;
        margin: 3px 0;
        line-height: 1.3;
    }

    .result-header p {
        font-size: 11pt;
        margin: 1px 0;
        line-height: 1.3;
    }

    .student-info {
        display: grid;
        grid-template-columns: 1fr 1fr !important;
        column-gap: 14px;
        row-gap: 3px;
        margin-bottom: 5px;
        font-size: 10pt;
    }

    .info-item {
        padding: 1px 0;
        line-height: 1.4;
        display: grid;
        grid-template-columns: 110px 1fr;
        column-gap: 6px;
        align-items: baseline;
        min-width: 0;
    }

    .info-label {
        color: #1f2937;
        font-weight: 700;
    }

    .marks-table {
        margin-bottom: 4px;
        page-break-inside: avoid;
    }

    table {
        width: 100%;
        border-collapse: collapse;
        font-size: 9pt;
        margin-bottom: 2px;
        line-height: 1.3;
    }

    th, td {
        border: 0.5px solid #000;
        padding: 2px 3px;
        text-align: center;
    }

    th {
        background: #e8f0ff;
        color: #1f2937;
        font-weight: 700;
        font-size: 9pt;
        line-height: 1.3;
    }

    .marks-table tbody tr:nth-child(odd) {
        background: #fafcff;
    }

    td:nth-child(2) {
        text-align: left;
    }

    .total-section {
        margin-top: 5px;
        page-break-inside: avoid;
    }

    .total-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 3px;
    }

    .total-item {
        border: 0.5px solid #000;
        padding: 3px;
        text-align: center;
    }

    .total-item h4 {
        font-size: 8pt;
        margin: 0 0 2px 0;
        line-height: 1.3;
    }

    .total-item p {
        font-size: 12pt;
        font-weight: bold;
        margin: 0;
        line-height: 1.3;
    }

    .signature-section {
        margin-top: 8px;
        padding-top: 4px;
        border-top: 1px solid #000;
        page-break-inside: avoid;
    }

    .signature-section > div {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        text-align: center;
        align-items: end;
    }

    .signature-box {
        padding: 0 3px;
    }

    .signature-line {
        height: 22px;
        border-bottom: 1px solid #000;
        margin-bottom: 2px;
    }

    .signature-label {
        margin: 0;
        font-weight: bold;
        font-size: 7.5pt;
        text-transform: uppercase;
        line-height: 1.2;
    }

    .declaration-date-section {
        margin-top: 5px;
        margin-bottom: 5px;
        padding: 4px;
        background: #f5f5f5;
        border: 0.5px solid #ccc;
        border-radius: 2px;
    }

    .declaration-date-section p {
        margin: 0;
        font-weight: bold;
        font-size: 8pt;
        text-align: center;
        line-height: 1.3;
    }

    .contact-footer {
        margin-top: 5px;
        padding-top: 3px;
        border-top: 0.5px solid #000;
        text-align: center;
    }

    .contact-footer p {
        margin: 0;
        font-size: 7pt;
        line-height: 1.3;
    }
}

/* Responsive */
@media screen and (max-width: 768px) {
    .hero-content h1 {
        font-size: 1.8rem;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 10px;
    }
    
    .student-info {
        grid-template-columns: 1fr;
    }
    
    .school-name {
        font-size: 1rem;
    }
}
