/* ==================== Reset & Base ==================== */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: vazir;
    direction: rtl;
    background: #fff;
}

.cafe {
    font-family: 'cafe' !important;
}

/* ==================== Layout ==================== */
#main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
#header {
    width: 100%;
    flex-shrink: 0;
}

#header h1 {
    margin: 16px 0;
}

/* Main row */
#main-row {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: stretch;
}

/* Content */
#content {
    flex: 1;
    min-width: 0;
    padding-bottom: 30px;
}

/* Sidebar */
#sidebar {
    flex: 0 0 20%;
    width: 20%;
    overflow: hidden;
}

/* Footer */
#footer {
    width: 100%;
    flex-shrink: 0;
    position: relative;
}

/* ==================== Sidebar Menu - Base ==================== */
#sidebar-menu {
    width: 100%;
}

/* ==================== Sidebar Menu - Mobile Animation ==================== */
@media screen and (max-width: 992px) {

    #main-row {
        flex-direction: column;
    }

    #sidebar {
        order: 1;
        width: 100%;
        flex: none;
        padding: 8px !important;
    }

    #content {
        order: 2;
        width: 100%;
    }

    #sidebar-menu {
        max-height: 0;
        overflow: hidden;
        transition: max-height .4s ease;
    }

    #sidebar-menu.open-mobile {
        max-height: 2000px;
    }
}

/* ==================== Sidebar Menu - Desktop ==================== */
@media screen and (min-width: 993px) {
    #sidebar-menu {
        max-height: none !important;
        overflow: visible !important;
    }
}

/* ==================== Small Mobile ==================== */
@media screen and (max-width: 600px) {

    #header {
        padding: 0 8px;
    }

    #header .w3-half {
        width: 100%;
        text-align: center !important;
    }

    #header h1 {
        font-size: 21px;
        line-height: 1.6;
        margin: 8px 0;
    }

    #content {
        width: 100%;
        padding: 10px !important;
    }

    #sidebar {
        width: 100%;
        padding: 8px !important;
    }

    #footer p {
        margin: 8px 0;
        font-size: 13px;
    }

    /* ==================== Mobile Card Table ==================== */
    .mobile-card-table {
        display: block;
        width: 100%;
    }

    .mobile-card-table thead {
        display: none;
    }

    .mobile-card-table tbody,
    .mobile-card-table tr,
    .mobile-card-table td {
        display: block;
        width: 100%;
    }

    .mobile-card-table tr {
        margin-bottom: 12px;
        padding: 10px;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, .15);
    }

    .mobile-card-table td {
        border: none;
        padding: 7px 5px;
        text-align: right !important;
    }

    .mobile-card-table td::before {
        content: attr(data-label);
        display: inline-block;
        min-width: 90px;
        font-weight: bold;
        margin-left: 10px;
    }

    .mobile-card-table tfoot {
        display: block;
        margin-top: 15px;
    }

    .mobile-card-table tfoot tr {
        display: block;
        padding: 12px;
        background: #e8f0f5;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, .15);
    }

    .mobile-card-table tfoot th,
    .mobile-card-table tfoot td {
        display: block;
        width: 100%;
        border: none;
        padding: 7px 5px;
        text-align: right !important;
    }

    .mobile-card-table tfoot th::before,
    .mobile-card-table tfoot td::before {
        content: attr(data-label);
        display: inline-block;
        min-width: 90px;
        margin-left: 10px;
        font-weight: bold;
    }
}

/* ==================== Dropdown / Accordion در Sidebar ==================== */
.menu-group {
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.menu-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    color: inherit;
    text-align: right;
    transition: background .3s ease;
}

.menu-group-header:hover {
    background: rgba(0, 0, 0, .06);
}

.menu-group-header .arrow {
    transition: transform .3s ease;
    font-size: 12px;
    margin-right: auto;
    margin-left: 8px;
}

.menu-group.open .menu-group-header .arrow {
    transform: rotate(180deg);
}

.menu-group-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .4s ease;
    background: rgba(0, 0, 0, .03);
}

.menu-group.open .menu-group-body {
    max-height: 1500px;
}

.menu-group-body a,
.menu-group-body button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 8px 24px 8px 12px !important;
    font-size: 14px;
    color: inherit;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: right;
    transition: background .3s ease;
    border-radius: 5px;
    margin-top: 5px;
}

.menu-group-body a:hover,
.menu-group-body button:hover {
    background: rgba(0, 0, 0, .07);
}

.menu-group-body i {
    font-size: 13px;
    opacity: .8;
}

/* ==================== Arrow Toggle (موبایل) ==================== */
.arrow-toggle {
    transition: transform .3s ease;
}

#sidebar-toggle-btn[aria-expanded="true"] .arrow-toggle {
    transform: rotate(180deg);
}


/* ==================== Quick Access Cards ==================== */
.quick-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 20px 12px !important;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
    border: 1px solid rgba(0, 0, 0, .06);
}

.quick-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .18) !important;
    filter: brightness(0.96);
}

.quick-card:hover .quick-icon {
    transform: scale(1.1);
}

.quick-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 10px;
    transition: transform .2s ease;
}

.quick-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

@media screen and (max-width: 600px) {
    .quick-icon {
        font-size: 26px;
    }

    .quick-title {
        font-size: 13px;
    }
}


