/* General Styles */
body {
    background-color: #F8F1E9; /* Ivory background */
    color: #333;
    font-family: 'Lora', serif;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative; /* Required for footer positioning */
}

/* Custom Color Classes */
.bg-navy {
    background: linear-gradient(90deg, #1A2A44 0%, #2C3E50 100%) !important;
}

.bg-ivory {
    background-color: #F8F1E9 !important;
}

.text-gold {
    color: #D4A017 !important;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    color: #1A2A44;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Navbar */
.navbar.bg-navy {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand.text-gold {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    transition: color 0.3s ease;
}

.navbar-brand.text-gold:hover {
    color: #E8B923 !important;
}

.nav-link.text-light {
    color: #E0E0E0 !important;
    font-weight: 500;
    font-size: 1rem; /* Increased for better mobile readability */
    transition: color 0.3s ease;
}

.nav-link.text-light:hover {
    color: #D4A017 !important;
}

.navbar-nav .dropdown-menu {
    background-color: #1A2A44;
    border: none;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.navbar-nav .dropdown-item {
    color: #E0E0E0;
    font-size: 0.95rem; /* Slightly larger for mobile */
    padding: 0.75rem 1.25rem;
    transition: all 0.3s ease;
}

.navbar-nav .dropdown-item:hover {
    background-color: #2C3E50;
    color: #D4A017;
}

.btn-outline-gold {
    border-color: #D4A017;
    color: #D4A017;
    font-size: 0.95rem; /* Increased for mobile */
    padding: 0.5rem 1rem; /* Improved touch target */
    transition: all 0.3s ease;
}

.btn-outline-gold:hover {
    background-color: #D4A017;
    color: #fff;
}

.btn-outline-light {
    border-color: #E0E0E0;
    color: #E0E0E0;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.btn-outline-light:hover {
    background-color: #E0E0E0;
    color: #1A2A44;
}

.btn-gold {
    background-color: #D4A017;
    color: #fff;
    border: none;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.btn-gold:hover {
    background-color: #E8B923;
    color: #fff;
}

/* Sidebar */
.app-sidebar.bg-navy {
    background: linear-gradient(180deg, #1A2A44 0%, #2C3E50 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1050; /* Ensure sidebar is above content on mobile */
}

.sidebar-brand .brand-link {
    padding: 1.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.brand-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
}

.nav-link.text-gold {
    font-size: 1rem; /* Increased for mobile */
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.nav-link.text-gold:hover {
    background-color: rgba(212, 160, 23, 0.1);
    color: #E8B923 !important;
}

.nav-treeview .nav-link {
    padding-left: 2rem;
    font-size: 0.95rem; /* Slightly larger for mobile */
    color: #E0E0E0;
}

.nav-treeview .nav-link:hover {
    background-color: rgba(212, 160, 23, 0.1);
    color: #D4A017;
}

/* Main Content */
.app-main {
    padding: 1.5rem; /* Reduced for mobile */
    min-height: calc(100vh - 180px);
}

.container.mt-4 {
    padding: 1rem; /* Adjusted for mobile */
}

/* Cards */
.card {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: none;
    background-color: #fff;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #1A2A44;
    color: #E0E0E0;
    padding: 1rem 1.25rem;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.card-header h2, .card-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Tables */
.table {
    font-size: 0.85rem; /* Increased for mobile readability */
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    background-color: #F8F1E9;
    color: #1A2A44;
    font-weight: 600;
    padding: 0.75rem;
    font-size: 0.9rem; /* Slightly larger for mobile */
}

.table td {
    vertical-align: middle;
    padding: 0.75rem; /* Increased for better touch targets */
    font-size: 0.85rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(212, 160, 23, 0.05);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #F9F9F9;
}

.table-responsive {
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on mobile */
}

.badge.bg-success {
    background-color: #28A745 !important;
    font-size: 0.85rem; /* Slightly larger */
}

.badge.bg-danger {
    background-color: #DC3545 !important;
    font-size: 0.85rem;
}

/* Forms */
.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid #CED4DA;
    font-size: 0.95rem; /* Increased for mobile */
    padding: 0.75rem; /* More padding for touch */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #D4A017;
    box-shadow: 0 0 0 0.2rem rgba(212, 160, 23, 0.25);
}

.form-label {
    font-weight: 500;
    color: #1A2A44;
    font-size: 0.95rem; /* Increased for mobile */
}

.text-danger {
    font-size: 0.9rem; /* Slightly larger for readability */
    margin-top: 0.25rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px; /* Increased for mobile */
}

/* Buttons */
.btn {
    border-radius: 6px; /* Slightly larger for smoother look */
    font-size: 0.95rem; /* Increased for mobile */
    padding: 0.5rem 1rem; /* Larger touch targets */
    transition: all 0.3s ease;
    min-width: 80px; /* Ensure buttons are tappable */
}

.btn-primary {
    background-color: #D4A017;
    border-color: #D4A017;
    color: #fff;
}

.btn-primary:hover {
    background-color: #E8B923;
    border-color: #E8B923;
}

.btn-secondary {
    background-color: #6C757D;
    border-color: #6C757D;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #5A6268;
    border-color: #5A6268;
}

.btn-warning {
    background-color: #FFC107;
    border-color: #FFC107;
    color: #1A2A44;
}

.btn-warning:hover {
    background-color: #FFCA2C;
    border-color: #FFCA2C;
}

.btn-danger {
    background-color: #DC3545;
    border-color: #DC3545;
}

.btn-danger:hover {
    background-color: #C82333;
    border-color: #C82333;
}

.btn-info {
    background-color: #17A2B8;
    border-color: #17A2B8;
}

.btn-info:hover {
    background-color: #138496;
    border-color: #138496;
}

.btn-success {
    background-color: #28A745;
    border-color: #28A745;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #218838;
}

.btn i {
    margin-right: 0.5rem;
}

.d-grid.gap-2.d-md-flex {
    gap: 0.75rem !important; /* Increased spacing for mobile */
}

/* Definition Lists (Details Views) */
.dl-horizontal dt, .row dt {
    font-weight: 600;
    color: #1A2A44;
    font-size: 0.95rem; /* Increased for mobile */
}

.dl-horizontal dd, .row dd {
    font-size: 0.95rem;
    color: #333;
}

/* Footer */
.app-footer.bg-navy, .footer.bg-navy {
    padding: 1.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer .text-light {
    color: #E0E0E0 !important;
    font-size: 0.9rem; /* Increased for mobile */
    transition: color 0.3s ease;
}

.footer .text-light:hover {
    color: #D4A017 !important;
}

.footer .text-gold {
    font-size: 1.1rem; /* Slightly larger for mobile */
}

/* Home Page */
.text-center h1.display-4 {
    font-size: 2.5rem; /* Adjusted for mobile */
    font-weight: 700;
    color: #1A2A44;
    margin-bottom: 1.5rem;
}

.text-center img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 250px; /* Fixed width for mobile sidebar */
    }

    .sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .navbar-brand {
        font-size: 1.5rem;
    }

    .nav-link {
        font-size: 0.95rem;
    }

    .container.mt-4 {
        padding: 0.75rem;
    }

    .card-header h2, .card-header h3 {
        font-size: 1.25rem;
    }
}

@media (max-width: 768px) {
    .app-main {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .table {
        font-size: 0.8rem; /* Slightly larger for readability */
    }

    .table th, .table td {
        padding: 0.5rem; /* Adjusted for mobile */
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .form-control, .form-select {
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    .form-label {
        font-size: 0.9rem;
    }

    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
        min-width: 70px;
    }

    .d-grid.gap-2.d-md-flex {
        flex-direction: column; /* Stack buttons vertically on mobile */
        align-items: stretch;
    }

    .d-grid.gap-2.d-md-flex .btn {
        width: 100%; /* Full-width buttons on mobile */
        margin-bottom: 0.5rem;
    }

    .footer .container {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .text-center h1.display-4 {
        font-size: 1.75rem; /* Smaller for mobile */
    }

    .card {
        margin: 0 0.5rem; /* Add margin for better spacing */
    }

    .dl-horizontal dt, .row dt {
        font-size: 0.9rem;
    }

    .dl-horizontal dd, .row dd {
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.25rem;
    }

    .container.mt-4 {
        padding: 0.5rem;
    }

    .card-header h2, .card-header h3 {
        font-size: 1.1rem;
    }

    .table th, .table td {
        font-size: 0.75rem;
        padding: 0.4rem;
    }

    .form-control, .form-select {
        font-size: 0.85rem;
    }

    .btn {
        font-size: 0.85rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card, .navbar, .app-sidebar, .table, .form-group {
    animation: fadeIn 0.5s ease-in;
}
