/* Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    font-size: 0.9rem;
    overflow: auto;
    background-color: #fff;
    margin: 0;
}

/* Login Bar - Single Line */
#login-bar {
    position: fixed;
    top: 80px;
    /* Below news(40) and menu(40) */
    left: 0;
    width: 100%;
    height: 40px;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 40px;
    z-index: 999;
}

#login-bar form {
    display: flex;
    gap: 10px;
    align-items: center;
}

#login-bar input {
    padding: 4px 8px;
    border: 1px solid #FFD700;
    background: #222;
    color: #fff;
    border-radius: 4px;
    font-size: 0.9rem;
}

#login-bar button {
    background: #FFD700;
    color: #000;
    border: none;
    padding: 4px 12px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
}

#login-msg {
    color: #ff4444;
    font-size: 0.8rem;
    margin-left: 10px;
}

#user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

#display-user {
    font-weight: bold;
    color: #FFD700;
    font-size: 1.1rem;
}

/* Background Photos */
#photo-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.bg-photo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.bg-photo.active {
    opacity: 1;
}

/* Home State */
.home-active #photo-container {
    display: block;
}

.home-active #app-content {
    display: none;
}

/* Page State (Admin/Management) */
.page-active {
    background-color: #f4f4f4;
}

.page-active #photo-container {
    display: none;
    /* Photos disappear on other pages */
}

.page-active #app-content {
    display: block;
    margin-top: 130px;
    /* News(40) + Menu(40) + Login(40) + 10px buffer */
    padding: 30px;
    z-index: 5;
    background: #fff;
    min-height: calc(100vh - 130px);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.1);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* News Bar */
#news-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background-color: #000;
    color: #FFD700;
    overflow: hidden;
    z-index: 1000;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #FFD700;
}

#news-content {
    white-space: nowrap;
    animation: scroll-left 30s linear infinite;
    /* Speed increased from 60s */
    padding-left: 100%;
    font-size: 1rem;
    font-weight: bold;
}

#news-bar:hover #news-content {
    animation-play-state: paused;
}

@keyframes scroll-left {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Menu Bar */
#menu-bar {
    position: fixed;
    top: 40px;
    left: 0;
    width: 100%;
    background-color: #FFD700;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.menu-toggle {
    display: none;
    padding: 10px 20px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    background-color: #FFD700;
    color: #000;
}

.main-menu {
    list-style: none;
    display: flex;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.main-menu>li {
    position: relative;
    padding: 12px 20px;
    cursor: pointer;
}

.main-menu>li>a {
    text-decoration: none;
    color: #000;
    font-weight: bold;
    font-size: 0.95rem;
    display: block;
}

.main-menu>li:hover {
    background-color: #e6c200;
}

/* Sub Menu */
.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #FFD700;
    list-style: none;
    width: max-content;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1001;
}

.main-menu>li:hover .sub-menu {
    display: block;
}

.sub-menu li {
    padding: 6px 15px;
    border-bottom: 1px solid #e6c200;
}

.sub-menu li a {
    text-decoration: none;
    color: #000;
    display: block;
    font-size: 0.9rem;
    white-space: nowrap;
}

.sub-menu li:hover {
    background-color: #e6c200;
}

/* Level 3 Menu */
.sub-menu li {
    position: relative;
}

.sub-sub-menu {
    display: none;
    position: absolute;
    top: 0;
    left: calc(100% - 2px);
    background-color: #FFD700;
    list-style: none;
    width: max-content;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1002;
    border-left: 1px solid #e6c200;
}

.sub-menu li:hover .sub-sub-menu {
    display: block;
}

/* Responsive */
@media screen and (max-width: 768px) {
    #login-bar {
        height: auto;
        min-height: 40px;
        padding: 5px 15px;
        flex-direction: column;
        justify-content: center;
    }

    #login-bar form {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    #login-bar input {
        width: calc(50% - 10px);
        min-width: 120px;
    }

    #user-info {
        flex-direction: row;
        font-size: 0.9rem;
    }

    .main-menu {
        display: none;
        width: 100%;
        position: fixed;
        top: 85px;
        /* Below header */
        left: 0;
        height: auto;
        max-height: calc(100vh - 85px);
        overflow-y: auto;
        background: rgba(20, 20, 20, 0.98);
        backdrop-filter: blur(5px);
        z-index: 1000;
        padding: 15px 10px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);

        /* Grid Layout for Tiles */
        display: none;
        /* Toggled to grid/flex via JS or active class */
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
        align-content: start;
    }

    .main-menu.active {
        display: grid;
        left: 0;
    }

    .main-menu.drill-down-active {
        grid-template-columns: 1fr;
        /* Full width long tiles */
    }

    .main-menu>li {
        border-bottom: none;
        width: 100%;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.08);
        /* Card background */
        transition: transform 0.2s, background 0.2s;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
        overflow: hidden;
        cursor: pointer;
        display: flex;
        flex-direction: column;
    }

    .main-menu>li.menu-back-tile {
        grid-column: 1 / -1;
        /* Take full width */
        background: rgba(255, 215, 0, 0.2);
        border: 1px solid rgba(255, 215, 0, 0.3);
        margin-bottom: 5px;
    }

    .main-menu>li.menu-back-tile a {
        flex-direction: row;
        justify-content: center;
        /* Centered */
        padding: 15px 15px;
        font-weight: bold;
        color: #FFD700;
        gap: 12px;
    }

    .main-menu>li:hover {
        background-color: rgba(255, 215, 0, 0.15);
        transform: translateY(-2px);
    }

    .main-menu>li>a {
        color: #fff;
        padding: 15px 10px;
        font-size: 0.85rem;
        display: flex;
        flex-direction: column;
        /* Stack icon and text */
        align-items: center;
        justify-content: center;
        text-align: center;
        width: 100%;
        height: 100%;
        gap: 6px;
        text-decoration: none;
    }

    .main-menu>li>a span {
        display: block;
        width: 100%;
        text-align: center;
    }

    /* Long Tiles for Sub-menus */
    .main-menu.drill-down-active>li>a {
        flex-direction: row;
        /* Horizontal style */
        padding: 18px 20px;
        font-size: 0.95rem;
        justify-content: center;
    }

    .main-menu.drill-down-active>li>a span {
        width: auto;
        text-align: center;
    }

    .main-menu>li>a>i {
        font-size: 1.3rem;
        margin-right: 0 !important;
        margin-bottom: 3px;
        color: #FFD700;
    }

    .main-menu.drill-down-active>li>a>i {
        margin-bottom: 0;
        margin-right: 15px !important;
        font-size: 1.2rem;
    }

    .main-menu>li>a .fa-chevron-down {
        display: none;
        /* Hide chevron in tile mode */
    }

    /* Chevron rotation - irrelevant in tile mode if we hide it, but keep for fallback */
    .main-menu>li.expanded>a>i.fa-chevron-down {
        transform: rotate(180deg);
    }

    /* Sub-menu Styling for Tiles */
    /* When expanded, maybe expansion isn't the best UI for tiles. 
       Better to just show sub-links below or have them click through.
       For now, let's make sub-menu expand cleanly within the tile or below it?
       Actually, standard accordion in a grid is messy. 
       Let's keep sub-menus hidden and maybe show them as a mini-list inside the larger card when clicked?
       Or, let's make the card expand to take full row width? That requires JS masonry or grid changes.
       Simpler: Clicking a tile toggles a list inside it. */

    .main-menu>li.expanded {
        grid-column: 1 / -1;
        /* Expand to full width when open */
        background: rgba(255, 255, 255, 0.12);
        order: -1;
        /* Move to top? No, might be confusing. Keep position. */
    }

    .sub-menu {
        display: none;
        position: static;
        background: transparent;
        box-shadow: none;
        width: 100%;
        padding: 0;
        margin-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .main-menu>li.expanded .sub-menu {
        display: block;
        animation: fadeIn 0.3s;
    }

    /* Sub-menu Overlay */
    #sub-menu-overlay {
        display: none;
        position: fixed;
        top: 85px;
        left: 0;
        width: 100%;
        height: calc(100vh - 85px);
        background: rgba(20, 20, 20, 0.98);
        backdrop-filter: blur(5px);
        z-index: 1010;
        /* Above main menu */
        padding: 20px;
        flex-direction: column;
        animation: slideInRight 0.3s ease-out;
    }

    #sub-menu-overlay.active {
        display: flex;
    }

    @keyframes slideInRight {
        from {
            transform: translateX(100%);
        }

        to {
            transform: translateX(0);
        }
    }

    .overlay-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .btn-overlay-back,
    .btn-overlay-close {
        background: rgba(255, 255, 255, 0.1);
        border: none;
        color: #fff;
        padding: 8px 15px;
        border-radius: 4px;
        font-weight: bold;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .btn-overlay-back:hover,
    .btn-overlay-close:hover {
        background: #FFD700;
        color: #000;
    }

    .overlay-title {
        color: #FFD700;
        font-size: 1rem;
        font-weight: bold;
    }

    /* Sub-menu Grid in Overlay */
    .sub-menu-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
        align-content: start;
        overflow-y: auto;
    }

    .sub-menu-tile {
        background: rgba(255, 255, 255, 0.08);
        border-radius: 12px;
        padding: 15px 10px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        color: #fff;
        text-decoration: none;
        text-align: center;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    }

    .sub-menu-tile i {
        font-size: 1.1rem;
        color: #FFD700;
    }

    .sub-menu-tile:hover {
        background: rgba(255, 215, 0, 0.15);
        transform: translateY(-2px);
    }

    .sub-menu li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        text-align: left;
    }

    .sub-menu li a {
        color: #ddd;
        font-size: 0.85rem;
        padding: 12px 20px;
        border-left: none;
        display: flex;
        align-items: center;
        flex-direction: row;
        /* Horizontal again for list */
        gap: 10px;
    }

    .sub-menu li a>i {
        font-size: 0.85rem;
        /* Normal size for sub-items */
        margin-right: 8px !important;
    }

    .sub-menu li a:hover {
        color: #FFD700;
        background: rgba(255, 255, 255, 0.05);
        border-left: none;
        padding-left: 20px;
    }

    .mobile-close-btn {
        display: none !important;
        /* in case it lingers */
    }


    .menu-toggle {
        display: block;
    }

    #app-content {
        margin-top: calc(85px + 40px);
        /* Ticker(40) + Menu(40) + Login(auto) */
        padding: 15px;
        width: 95%;
    }
}

@media screen and (max-width: 480px) {
    #login-bar input {
        width: 100%;
    }

    #app-content {
        padding: 10px;
    }

    .container {
        padding: 15px !important;
    }

    h1 {
        font-size: 1.5rem;
    }
}

/* Scrollable Tables Utility */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Admin Specific Overrides */
.admin-section {
    border: 1px solid #ddd;
    padding: 20px;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 4px;
}

/* =========================================
   Bank Management & Shared Admin Styles
   ========================================= */

/* Main Container used by sub-pages */
.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #333;
    border-bottom: 2px solid #ffcc00;
    padding-bottom: 10px;
}

/* Tab Buttons */
.tab-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: background 0.3s;
}

.tab-btn.active {
    background-color: #007bff;
    color: white;
}

.tab-btn:hover {
    opacity: 0.9;
}

/* Form Sections */
.form-section {
    background: #eee;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 30px;
}

.form-section input {
    padding: 10px;
    width: 100%;
    max-width: 300px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 10px;
}

.form-section button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 5px;
}

/* Buttons */
.btn-save {
    background: #4CAF50;
    color: white;
}

.btn-clear {
    background: #999;
    color: white;
}

.btn-edit {
    background: #007bff;
    color: white;
}

.btn-delete {
    background: #ff4444;
    color: white;
}

/* Bank List */
.bank-list ul {
    list-style: none;
    padding: 0;
}

.bank-list li {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bank-list li:last-child {
    border-bottom: none;
}

.bank-list button {
    padding: 5px 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 5px;
}

/* Tab Sections */
.tab-section {
    display: none;
}

.tab-section.active {
    display: block;
}

/* Responsiveness */
@media (max-width: 600px) {
    .form-section input {
        max-width: none;
    }

    .bank-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Modal Fixes */
.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    width: 600px;
    /* Increased from default */
    max-width: 95%;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* Permission Tree Styles */
#permission-tree {
    text-align: left;
}

#permission-tree ul {
    list-style: none;
    padding-left: 20px;
    margin: 0;
}

/* Specific fix for root UL to not have extra padding if desired, or keep uniform */
#permission-tree>ul {
    padding-left: 0;
}

#permission-tree li {
    margin-bottom: 5px;
}

#permission-tree .tree-item-header {
    display: flex;
    align-items: center;
}

#permission-tree input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

#permission-tree label {
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.5;
}

.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: #fff;
}

.data-table th,
.data-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background-color: #f8f9fa;
    color: #333;
    font-weight: bold;
    border-top: 2px solid #ffcc00;
}

.data-table tr:hover {
    background-color: #f1f1f1;
}

.data-table .actions {
    display: flex;
    gap: 5px;
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #495057;
}

/* =========================================
   Unified Modal Styles
   ========================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fff;
    margin: auto;
    padding: 25px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #aaa;
}

.close-modal:hover {
    color: #000;
}

.modal-body input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.perm-group {
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.perm-group h4 {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    color: #666;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.perm-item {
    display: block;
    margin-bottom: 5px;
    cursor: pointer;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

/* --- Universal Report Styling System (Arial Match Sync) --- */
.container-fluid {
    width: 95%;
    margin: 10px auto;
    max-width: 1200px;
    font-family: Arial, sans-serif;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #ffcc00;
    padding-bottom: 5px;
    margin-bottom: 20px;
    /* Matched to Student List */
}

.report-header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
    font-family: Arial, sans-serif;
}

.btn-close {
    background: #ff4444;
    /* Matched to Student List */
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    font-family: Arial, sans-serif;
    transition: background 0.2s;
}

.btn-close:hover {
    background: #c82333;
}

.controls-box {
    background: #f8f9fa;
    /* Matched to Student List */
    padding: 15px;
    border-radius: 8px;
    box-shadow: none;
    border: 1px solid #ddd;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    /* Force two-row structure */
    align-items: flex-start;
    font-family: Arial, sans-serif;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 150px;
    font-size: 0.9rem;
    font-family: Arial, sans-serif;
    outline: none;
}

.filter-group select:focus {
    border-color: #ffcc00;
}

.btn-group {
    display: flex;
    gap: 10px;
}

.btn-action {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-family: Arial, sans-serif;
    transition: transform 0.1s;
}

.btn-action:active {
    transform: scale(0.98);
}

.btn-web {
    background-color: #007bff;
}

.btn-excel {
    background-color: #28a745;
}

.btn-pdf {
    background-color: #dc3545;
}

.table-responsive {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    border: 1px solid #e0e0e0;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, sans-serif;
}

.report-table th,
.report-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.report-table th {
    background-color: #ffcc00;
    color: #000;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e6b800;
    white-space: nowrap;
}

.col-sno {
    width: 70px;
    text-align: center !important;
    white-space: nowrap;
}

.report-table tr:nth-child(even) {
    background-color: #fff9e6;
}

.report-table tr:hover {
    background-color: #fff3cd;
}

.no-data {
    padding: 30px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    font-size: 0.85rem;
    font-family: Arial, sans-serif;
}