:root {
    --diu-green: #006A4E;
    --diu-dark: #004d39;
    --diu-light: #e6f2ef;
    --diu-accent: #ffc107;
    --text-dark: #333;
    --text-muted: #6c757d;
    --gray-light: #f8f9fa;
    --gray-medium: #e9ecef;
    --shadow-sm: 0 2px 4px rgba(0,0,0,.05);
    --shadow-md: 0 4px 8px rgba(0,0,0,.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,.1);
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f5f8fa;
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== Navbar Styles ===== */
.navbar {
    background-color: #fff;
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--diu-green);
}

.navbar-brand span {
    display: inline-block;
    margin-left: 10px;
    font-size: 1.1rem;
}

.navbar-logo {
    height: 42px;
}

.navbar-toggler {
    border: none;
    color: var(--diu-green);
}

.nav-link {
    color: var(--text-dark);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--diu-green);
}

/* ===== Main Container Styles ===== */
.main-container {
    padding: 1rem 0;
}

/* ===== Hero Section Styles ===== */
.hero-section {
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #ffffff 0%, var(--diu-light) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.hero-title {
    color: var(--diu-green);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 90%;
    margin-bottom: 1.5rem;
}

.form-card {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 1rem;
}

.card-title {
    color: var(--diu-green);
    font-weight: 600;
    text-align: center;
}

.form-label {
    font-weight: 500;
    color: var(--text-dark);
}

.input-group-text {
    background-color: var(--diu-green);
    color: white;
    border: none;
}

.form-control {
    border: 1px solid #ced4da;
    padding: 0.6rem 0.75rem;
}

.form-control:focus {
    border-color: var(--diu-green);
    box-shadow: 0 0 0 0.25rem rgba(0, 106, 78, 0.25);
}

.form-text {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.btn-primary {
    background-color: var(--diu-green);
    border-color: var(--diu-green);
    padding: 0.6rem 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--diu-dark);
    border-color: var(--diu-dark);
    transform: translateY(-1px);
}

/* ===== Loading Indicator Styles ===== */
#loadingIndicator {
    padding: 3rem 0;
}

.loading-animation {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid var(--gray-medium);
    border-bottom-color: var(--diu-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ===== Result Section Styles ===== */
.result-section {
    margin-bottom: 3rem;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.result-header h2 {
    color: var(--diu-green);
    font-weight: 600;
    margin: 0;
}

.semester-badge {
    background-color: var(--diu-green);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.9rem;
}

.info-card, .result-table-card {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: var(--diu-green);
    color: white;
    padding: 1rem 1.5rem;
    font-weight: 500;
}

.info-item {
    padding: 1rem;
    border-radius: var(--radius-sm);
    background-color: var(--gray-light);
    height: 100%;
}

.info-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.info-value {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.cgpa {
    color: var(--diu-green);
    font-weight: 700;
}

.table {
    margin-bottom: 0;
}

.table thead {
    background-color: var(--diu-green);
    color: white;
}

.table thead th {
    font-weight: 500;
    padding: 1rem;
    border-bottom: none;
}

.table tbody tr {
    border-bottom: 1px solid var(--gray-medium);
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--diu-light);
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

.result-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-success, .btn-info, .btn-secondary {
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    border: none;
    transition: all 0.3s ease;
    border-radius: var(--radius-md);
}

.btn-success {
    background-color: #28a745;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-success:hover, .btn-info:hover, .btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ===== Error Container Styles ===== */
#errorContainer {
    margin: 2rem 0;
    border-radius: var(--radius-md);
    border-left: 5px solid #dc3545;
}

/* ===== Features Section Styles ===== */
.features-section {
    margin: 3rem 0 4rem;
    text-align: center;
}

.section-title {
    color: var(--diu-green);
    font-weight: 600;
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--diu-accent);
}

.feature-card {
    background-color: white;
    border-radius: var(--radius-md);
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow-md);
    height: 100%;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--diu-green);
    margin-bottom: 1.5rem;
    display: inline-block;
    background-color: var(--diu-light);
    height: 80px;
    width: 80px;
    line-height: 80px;
    border-radius: 50%;
}

.feature-card h4 {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Footer Styles ===== */
footer {
    background-color: #2f3640;
    color: #f5f6fa;
    padding: 3rem 0 1rem;
    margin-top: 2rem;
}

footer h5 {
    color: white;
    font-weight: 600;
    margin-bottom: 1.2rem;
    position: relative;
    padding-bottom: 0.5rem;
}

footer h5::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: var(--diu-accent);
}

footer p {
    color: #bdc3c7;
    font-size: 0.9rem;
}

.footer-links {
    padding: 0;
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: white;
}

.footer-contact {
    padding: 0;
    list-style: none;
}

.footer-contact li {
    margin-bottom: 0.8rem;
    color: #bdc3c7;
    font-size: 0.9rem;
}

.footer-contact li i {
    margin-right: 8px;
    color: var(--diu-accent);
}

.social-icons {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

.social-icons a {
    color: #bdc3c7;
    font-size: 1rem;
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.1);
    height: 36px;
    width: 36px;
    line-height: 36px;
    text-align: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.social-icons a:hover {
    color: white;
    background-color: var(--diu-green);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
    margin-top: 2rem;
}

.disclaimer {
    font-size: 0.8rem;
    margin-top: 5px;
    color: #95a5a6;
}

/* ===== Print Styles ===== */
@media print {
    @page {
        size: A4;
        margin: 5mm; /* Reduced margins to maximize space */
    }
    
    body {
        background-color: white;
        font-size: 9pt !important; /* Reduced base font size */
        line-height: 1.2;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
    }
    
    .navbar, .hero-section, .features-section, footer, .btn {
        display: none !important;
    }
    
    .container {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .main-container {
        padding: 0;
    }
    
    .result-section {
        margin: 0;
        padding: 5px;
        max-width: 100%;
    }
    
    .result-header {
        margin-bottom: 10px;
    }
    
    .result-header h2 {
        font-size: 12pt;
        margin: 0;
    }
    
    .semester-badge {
        padding: 2px 8px;
        font-size: 8pt;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 8px;
        break-inside: avoid;
    }
    
    .card-header {
        color: black;
        background-color: #f5f5f5;
        padding: 4px 8px;
        font-size: 10pt;
    }
    
    .card-header h3 {
        font-size: 10pt;
        margin: 0;
    }
    
    .card-body {
        padding: 5px 8px;
    }
    
    /* Compact student info card */
    .info-card .card-body {
        padding: 4px;
    }
    
    .info-card .row {
        margin: 0 -2px;
    }
    
    .info-card .col-12 {
        padding: 0 2px;
    }
    
    .info-item {
        background-color: white;
        padding: 4px;
        height: auto;
        margin-bottom: 0;
    }
    
    .info-label {
        font-size: 7pt;
        margin-bottom: 2px;
    }
    
    .info-value {
        font-size: 9pt;
        margin: 0;
    }
    
    /* Compact table */
    .table {
        font-size: 8pt;
        width: 100%;
        margin-bottom: 0;
    }
    
    .table thead th {
        background-color: #f5f5f5;
        color: black;
        padding: 3px;
        font-size: 8pt;
    }
    
    .table tbody td {
        padding: 3px;
        line-height: 1.1;
    }
    
    /* Remove element that takes extra space */
    .motivational-message {
        display: none;
    }
    
    .badge {
        border: 1px solid #ddd;
        background-color: transparent !important;
        color: black !important;
        padding: 1px 3px;
        font-size: 7pt;
    }
    
    /* Compact motivational message */
    .motivational-container {
        margin-top: 8px;
        border: 1px solid #ddd;
        background: none;
    }
    
    .motivational-container .card-body {
        padding: 5px;
    }
    
    .motivational-container h4 {
        font-size: 9pt;
        margin: 0 0 2px 0;
    }
    
    .motivational-message-overall {
        color: black !important;
        font-size: 8pt;
        padding: 3px;
        margin: 0;
    }
    
    /* Simplified header */
    .result-section::before {
        content: '';
        background-image: url('https://daffodilvarsity.edu.bd/template/images/diulogo.png');
        background-repeat: no-repeat;
        background-position: center top;
        background-size: 50px auto;
        padding-top: 55px;
        display: block;
        text-align: center;
        width: 100%;
        margin-bottom: 2px;
    }
    
    .result-section::after {
        content: 'Daffodil International University - Academic Result';
        display: block;
        text-align: center;
        font-size: 10pt;
        font-weight: bold;
        color: #006A4E;
        margin-bottom: 5px;
    }
    
    /* Force table to be more compact */
    .result-table-card {
        page-break-inside: avoid;
    }
    
    .result-table-card .table-responsive {
        overflow: visible;
    }
    
    /* Remove any bottom margins from the last element */
    .result-section > *:last-child {
        margin-bottom: 0;
    }
    
    /* Prevent any page breaks */
    .result-section {
        page-break-inside: avoid;
    }
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 1199px) {
    .hero-title {
        font-size: 2.2rem;
    }
    
    .info-value {
        font-size: 1rem;
    }
}

@media (max-width: 991px) {
    .hero-section {
        text-align: center;
        padding: 2rem 1rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        margin: 0 auto 2rem;
    }
    
    .feature-card {
        margin-bottom: 1.5rem;
    }
    
    .form-card {
        margin-top: 2rem;
    }
    
    .table {
        font-size: 0.95rem;
    }
    
    .table td, .table th {
        padding: 0.75rem;
    }
}

@media (max-width: 767px) {
    .navbar-brand span {
        font-size: 0.9rem;
    }
    
    .navbar-logo {
        height: 35px;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .footer {
        text-align: center;
    }
    
    footer h5::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .social-icons {
        justify-content: center;
    }
    
    .col-md-4 {
        margin-bottom: 1.5rem;
    }
    
    .semester-badge {
        align-self: flex-start;
    }
    
    .info-item {
        margin-bottom: 0.5rem;
    }
    
    .table-responsive {
        border: none;
    }
}

@media (max-width: 575px) {
    .navbar-brand span {
        font-size: 0.8rem;
    }
    
    .hero-section {
        padding: 1.5rem 1rem;
    }
    
    .hero-title {
        font-size: 1.6rem;
    }
    
    .card-title {
        font-size: 1.2rem;
    }
    
    .card-header h3 {
        font-size: 1rem;
    }
    
    .table {
        font-size: 0.9rem;
    }
    
    .result-header h2 {
        font-size: 1.4rem;
    }
    
    .semester-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .result-actions .btn {
        width: 100%;
    }
    
    .feature-icon {
        height: 60px;
        width: 60px;
        line-height: 60px;
        font-size: 1.8rem;
    }
    
    .feature-card h4 {
        font-size: 1.1rem;
    }
    
    footer h5 {
        font-size: 1.1rem;
    }
    
    .motivational-message {
        font-size: 0.75rem;
    }
    
    .motivational-message-overall {
        font-size: 1rem;
        padding: 0.75rem;
    }
}

/* Mobile-first table styles for small screens */
@media (max-width: 480px) {
    .table-responsive {
        overflow-x: auto;
    }
    
    .table {
        width: 100%;
        min-width: 480px;  /* Ensure minimum width for scrolling */
    }
    
    .info-label {
        font-size: 0.8rem;
    }
    
    .info-value {
        font-size: 0.95rem;
    }
    
    /* Custom display for badges on mobile */
    .badge {
        padding: 0.35em 0.65em;
        font-size: 0.75em;
    }
}

/* ===== Motivational Message Styles ===== */
.motivational-message {
    font-size: 0.8rem;
    margin-top: 5px;
    font-style: italic;
    display: block;
}

.motivational-message i {
    margin-right: 3px;
}

.motivational-container {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, #ffffff 0%, var(--diu-light) 100%);
}

.motivational-message-overall {
    font-size: 1.2rem;
    font-weight: 500;
    padding: 1rem;
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0;
}