:root {
    --dark-blue: #0C043F;
    --golden: #C98D2A;
    --dark-maroon: #913E16;
    --white: #FFFFFF;
    --black: #020101;
    --light-gray: #f5f5f5;
    --medium-gray: #e0e0e0;
    --dark-gray: #333333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--light-gray);
    color: var(--dark-blue);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px; /* Reduced from 1400px */
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
header {
    background-color: var(--white);
    color: var(--dark-blue);
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo {
    width: 200px; /* Reduced from 224px */
    height: 75px; /* Reduced from 84px */
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Main Content Styles */
main {
    padding: 20px 0; /* Reduced from 40px */
    min-height: calc(100vh - 140px);
}

.calculator-container {
    background-color: var(--white);
    border-radius: 8px; /* Reduced from 10px */
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1); /* Reduced shadow */
    padding: 25px; /* Reduced from 40px */
    margin-bottom: 20px;
    width: 100%;
    transform: scale(0.95); /* Added zoom out */
    transform-origin: top center;
}

.section-title {
    color: var(--dark-maroon);
    margin-bottom: 15px; /* Reduced from 20px */
    padding-bottom: 8px; /* Reduced from 10px */
    border-bottom: 2px solid var(--golden);
    font-size: 22px; /* Reduced from 24px */
    text-align: center;
}

.form-group {
    margin-bottom: 15px; /* Reduced from 20px */
}

label {
    display: block;
    margin-bottom: 6px; /* Reduced from 8px */
    font-weight: 600;
    color: var(--dark-blue);
    font-size: 14px; /* Added font size */
}

select, input {
    width: 100%;
    padding: 10px 12px; /* Reduced from 12px 15px */
    border: 1px solid #ddd;
    border-radius: 4px; /* Reduced from 5px */
    font-size: 14px; /* Reduced from 16px */
    background-color: var(--white);
    color: var(--dark-blue);
}

select:focus, input:focus {
    outline: none;
    border-color: var(--golden);
    box-shadow: 0 0 0 2px rgba(201, 141, 42, 0.2);
}

.form-row {
    display: flex;
    gap: 15px; /* Reduced from 20px */
}

.form-row .form-group {
    flex: 1;
}

.scholarship-group {
    background-color: #f9f9f9;
    padding: 12px; /* Reduced from 15px */
    border-radius: 4px; /* Reduced from 5px */
    margin-bottom: 12px; /* Reduced from 15px */
    border-left: 3px solid var(--golden); /* Reduced from 4px */
}

.scholarship-title {
    color: var(--dark-maroon);
    margin-bottom: 8px; /* Reduced from 10px */
    font-weight: 600;
    font-size: 15px; /* Added font size */
}

.gender-note {
    font-size: 11px; /* Reduced from 12px */
    color: #2e7d32;
    margin-top: 4px; /* Reduced from 5px */
}

.calculate-btn {
    background-color: var(--dark-maroon);
    color: var(--white);
    border: none;
    padding: 12px 25px; /* Reduced from 15px 30px */
    font-size: 16px; /* Reduced from 18px */
    border-radius: 4px; /* Reduced from 5px */
    cursor: pointer;
    transition: background-color 0.3s;
    display: block;
    margin: 25px auto 0; /* Reduced from 30px */
    width: 180px; /* Reduced from 200px */
}

.calculate-btn:hover {
    background-color: var(--dark-blue);
}

/* Results Section */
.results-container {
    background-color: var(--white);
    border-radius: 8px; /* Reduced from 10px */
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    padding: 25px; /* Reduced from 40px */
    display: none;
    width: 100%;
    overflow: hidden;
}

/* Student Info Section */
.student-info-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid var(--dark-blue);
}

.student-info-section h2 {
    color: var(--dark-blue);
    font-size: 18px;
    margin-bottom: 12px;
    text-align: center;
}

.student-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--medium-gray);
}

.detail-label {
    font-weight: 600;
    color: var(--dark-blue);
    font-size: 13px;
}

.detail-value {
    color: var(--dark-maroon);
    font-weight: 500;
    font-size: 13px;
    text-align: right;
}

.results-title {
    color: var(--dark-maroon);
    margin-bottom: 15px; /* Reduced from 20px */
    text-align: center;
    font-size: 20px; /* Reduced from 24px */
    padding-bottom: 8px;
    border-bottom: 2px solid var(--golden);
}

/* Fee Breakdown Table */
.fee-breakdown-container {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 15px; /* Reduced from 20px */
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--medium-gray);
    border-radius: 4px; /* Reduced from 5px */
}

.fee-breakdown {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
    font-size: 13px;
}

.fee-breakdown th, .fee-breakdown td {
    padding: 10px 8px; /* Adjusted padding */
    text-align: left;
    border: 1px solid #ddd;
    word-wrap: break-word;
    white-space: nowrap;
    min-width: 120px; /* Adjusted */
    font-size: 12px;
}

.fee-breakdown th {
    background-color: var(--dark-blue);
    color: var(--white);
    position: sticky;
    top: 0;
    font-weight: 600;
    font-size: 12px;
}

.fee-breakdown tr:nth-child(even) {
    background-color: #f9f9f9;
}

.fee-breakdown .total-row {
    font-weight: bold;
    background-color: var(--golden);
    color: var(--dark-blue);
}

/* Semester Table Styles */
.semester-fees {
    margin-top: 20px; /* Reduced from 30px */
    width: 100%;
}

.semester-fees h3 {
    color: var(--dark-maroon);
    margin-bottom: 12px; /* Reduced from 15px */
    text-align: center;
    font-size: 16px; /* Reduced from 18px */
}

.semester-table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--medium-gray);
    border-radius: 4px; /* Reduced from 5px */
}

.semester-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
    font-size: 13px;
}

.semester-table th, .semester-table td {
    padding: 10px 8px; /* Adjusted */
    text-align: center;
    border: 1px solid #ddd;
    min-width: 140px; /* Adjusted */
    font-size: 12px;
}

.semester-table th {
    background-color: var(--dark-maroon);
    color: var(--white);
    font-weight: 600;
    font-size: 12px;
}

.semester-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 12px; /* Reduced from 15px */
    margin-top: 20px; /* Reduced from 30px */
    width: 100%;
}

.print-btn, .back-btn {
    background-color: var(--dark-blue);
    color: var(--white);
    border: none;
    padding: 10px 18px; /* Reduced from 12px 20px */
    font-size: 13px; /* Reduced from 14px */
    border-radius: 4px; /* Reduced from 5px */
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 5px; /* Reduced from 6px */
    flex: 1;
    max-width: 180px; /* Reduced from 200px */
    justify-content: center;
}

.print-btn:hover, .back-btn:hover {
    background-color: var(--dark-maroon);
}

.note {
    margin-top: 15px; /* Reduced from 20px */
    padding: 10px; /* Reduced from 12px */
    background-color: #fff9e6;
    border-left: 3px solid var(--golden); /* Reduced from 4px */
    border-radius: 4px; /* Reduced from 5px */
    width: 100%;
}

.note p {
    margin-bottom: 4px; /* Reduced from 5px */
    font-size: 11px;
    line-height: 1.3;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
        max-width: 100%;
    }
    
    .calculator-container {
        transform: scale(1); /* Reset scale on mobile */
        padding: 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .student-details {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .print-btn, .back-btn {
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .calculator-container, .results-container {
        padding: 15px;
    }
    
    .detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .detail-value {
        text-align: left;
    }
}

/* PRINT STYLES - PROFESSIONAL SINGLE PAGE */


/* Print Header Styling - ONLY FOR PRINT */
@media print {
    .print-header {
        display: block !important;
        visibility: visible !important;
        page-break-inside: avoid !important;
        margin-bottom: 15px !important;
        padding-bottom: 10px !important;
        border-bottom: 2px solid #000 !important;
    }
    
    .print-logo-row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        margin-bottom: 10px !important;
    }
    
    .print-logo-left {
        flex: 1;
        text-align: left !important;
    }
    
    .print-logo-right {
        flex: 1;
        text-align: right !important;
        font-size: 10px !important;
        color: #666 !important;
    }
    
    .print-logo {
        width: 120px !important;
        height: 45px !important;
        margin: 0 !important;
        margin-bottom: 5px !important;
    }
    
    .print-logo img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }
    
    .print-date, .print-student-info {
        font-size: 9px !important;
        color: #333 !important;
        margin-top: 3px !important;
        line-height: 1.2 !important;
    }
    
    .print-university-info {
        text-align: center !important;
        margin: 10px 0 !important;
    }
    
    .print-university-info h2 {
        font-size: 16px !important;
        margin-bottom: 3px !important;
        color: #000 !important;
        font-weight: bold !important;
    }
    
    .print-university-info p {
        font-size: 9px !important;
        line-height: 1.2 !important;
        color: #000 !important;
        margin-bottom: 2px !important;
    }
}

/* Hide print header on screen */
.print-header {
    display: none !important;
}


@media print {
    @page {
        size: A4 portrait;
        margin: 0.5cm !important;
    }
    
    body * {
        visibility: hidden;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .results-container,
    .results-container * {
        visibility: visible;
    }
    
    /* Print Header with Logo */
    .print-header {
        display: block !important;
        visibility: visible !important;
        text-align: left !important;
        margin-bottom: 15px !important;
        padding-bottom: 10px !important;
        border-bottom: 2px solid #000 !important;
    }
    
    .print-logo-row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        margin-bottom: 10px !important;
    }
    
    .print-logo-left {
        flex: 1;
        text-align: left !important;
    }
    
    .print-logo-right {
        flex: 1;
        text-align: right !important;
        font-size: 10px !important;
        color: #666 !important;
    }
    
    .print-logo {
        width: 120px !important;
        height: 45px !important;
        margin: 0 !important;
    }
    
    .print-logo img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }
    
    .print-date {
        font-size: 10px !important;
        color: #666 !important;
        margin-top: 5px !important;
    }
    
    .print-university-info {
        text-align: center !important;
        margin: 10px 0 !important;
    }
    
    .print-university-info h2 {
        font-size: 16px !important;
        margin-bottom: 3px !important;
        color: #000 !important;
        font-weight: bold !important;
    }
    
    .print-university-info p {
        font-size: 9px !important;
        line-height: 1.2 !important;
        color: #000 !important;
        margin-bottom: 2px !important;
    }
    
    .results-container {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 15px !important;
        page-break-inside: avoid !important;
        overflow: visible !important;
        height: auto !important;
        transform: scale(1) !important;
        transform-origin: top center !important;
    }
    
    /* Hide non-print elements */
    header, footer, .calculator-container, .action-buttons {
        display: none !important;
    }
    
    /* Student info styling for print */
    .student-info-section {
        background: white !important;
        border: 1px solid #000 !important;
        padding: 10px !important;
        margin-bottom: 15px !important;
    }
    
    .student-info-section h2 {
        font-size: 14px !important;
        color: #000 !important;
    }
    
    .student-details {
        display: block !important;
    }
    
    .detail-item {
        display: flex !important;
        justify-content: space-between !important;
        padding: 4px 0 !important;
        border-bottom: 1px dotted #ccc !important;
    }
    
    .detail-label {
        font-size: 10px !important;
        color: #000 !important;
    }
    
    .detail-value {
        font-size: 10px !important;
        color: #000 !important;
        font-weight: normal !important;
    }
    
    /* Tables styling for print */
    .results-title {
        font-size: 14px !important;
        margin-bottom: 12px !important;
        color: #000 !important;
    }
    
    .fee-breakdown-container,
    .semester-table-container {
        overflow: visible !important;
        width: 100% !important;
        border: 1px solid #000 !important;
        margin-bottom: 12px !important;
        page-break-inside: avoid !important;
    }
    
    .fee-breakdown,
    .semester-table {
        width: 100% !important;
        min-width: 100% !important;
        font-size: 10px !important; /* Increased from 9px */
        border-collapse: collapse !important;
    }
    
    .fee-breakdown th, .fee-breakdown td,
    .semester-table th, .semester-table td {
        padding: 6px 4px !important; /* Increased padding */
        font-size: 10px !important; /* Increased font size */
        border: 1px solid #000 !important;
        line-height: 1.3 !important;
    }
    
    .fee-breakdown th,
    .semester-table th {
        background-color: #f0f0f0 !important;
        color: #000 !important;
        font-weight: bold !important;
        font-size: 10px !important;
    }
    
    /* Semester section */
    .semester-fees {
        margin-top: 15px !important;
    }
    
    .semester-fees h3 {
        font-size: 12px !important;
        margin-bottom: 8px !important;
        color: #000 !important;
    }
    
    /* Notes section */
    .note {
        margin-top: 12px !important;
        padding: 8px !important;
        font-size: 9px !important;
        border: 1px solid #000 !important;
        background-color: #fff !important;
        page-break-inside: avoid !important;
    }
    
    .note p {
        font-size: 9px !important;
        margin-bottom: 3px !important;
        line-height: 1.2 !important;
        color: #000 !important;
    }
    
    /* Ensure single page */
    html, body {
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    /* Prevent page breaks */
    .results-container,
    .student-info-section,
    .fee-breakdown-container,
    .semester-table-container,
    .note {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    /* Center content in print */
    .print-content {
        text-align: center !important;
    }
}

/* Footer Styles */
footer {
    background-color: #10386b;
    color: var(--white);
    text-align: center;
    padding: 15px 0;
    width: 100%;
    margin-top: 20px;
}

.footer-content p {
    margin: 5px 0;
    font-size: 13px;
}

/* Custom scrollbar */
.fee-breakdown-container::-webkit-scrollbar,
.semester-table-container::-webkit-scrollbar {
    height: 5px;
}

.fee-breakdown-container::-webkit-scrollbar-track,
.semester-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.fee-breakdown-container::-webkit-scrollbar-thumb,
.semester-table-container::-webkit-scrollbar-thumb {
    background: var(--golden);
    border-radius: 3px;
}

.fee-breakdown-container::-webkit-scrollbar-thumb:hover,
.semester-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--dark-maroon);
}