/* Mobile Bottom Navigation & Side Drawer */

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    right: auto;
    width: 100%;
    max-width: var(--container);
    padding-bottom: env(safe-area-inset-bottom, 0);
    min-height: calc(65px + env(safe-area-inset-bottom, 0));
    height: auto;
    background-color: var(--card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px #0000001a;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1200;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 10px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0) + 8px);
    transform: translate(-50%) translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: auto;
    box-sizing: border-box;
}

/* 
   We need to lift the reset-fab so it doesn't overlap with the bottom nav.
   In style.css it has z-index: 2140.
   We'll target it here to override its bottom position.
*/
.reset-fab {
    bottom: calc(90px + env(safe-area-inset-bottom)) !important;
}


.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--muted);
    width: 20%;
    height: 100%;
    transition: all .2s ease;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    /* padding: 5px 0; */
}

.nav-item span {
    font-size: 1.1rem;
    font-weight: 500;
    font-family: "kfgqpc_uthman_taha_naskh", "Noto Naskh Arabic UI", "Tajawal", "Amiri", "Arial", sans-serif;
}

.nav-item.active {
    color: var(--accent);
}

.nav-item svg {
    width: 30px;
    height: 30px;
    margin-bottom: 2px;
    fill: none;
}

.nav-item img {
    width: 30px;
    height: 30px;
    margin-bottom: 0px;
    object-fit: contain;
}



/* Adjust body padding so content isn't hidden behind nav */
body {
    padding-bottom: calc(110px + env(safe-area-inset-bottom)) !important;
}

/* Ensure main containers have enough bottom padding */
.wrap,
.container {
    padding-bottom: 40px !important;
}

/* --- Side Drawer (Right Side) --- */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2500;
    /* Above everything */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(0.5px);
}

.drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.side-drawer {
    position: fixed;
    top: 0;
    right: -200px;
    /* Hidden initially */
    width: 200px;
    height: 100%;
    background: var(--card);
    z-index: 2600;
    /* Above overlay */
    transition: right 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.side-drawer.open {
    right: 0;
}

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--fg);
    margin: 0;
}

.drawer-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 5px;
}

.drawer-content {
    padding: 10px 0;
    flex: 1;
}

.drawer-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--fg);
    font-size: 1.1rem;
    /* Increased to 1.1rem */
    transition: background 0.2s;
}

.drawer-link:hover,
.drawer-link:focus {
    background-color: var(--border);
    /* Slightly darker than card */
}


.drawer-link svg {
    margin-left: 12px;
    /* RTL margin */
    width: 22px;
    height: 22px;
    object-fit: contain;
    color: var(--accent);
}

.drawer-link img {
    margin-left: 12px;
    /* RTL margin */
    width: 24px;
    /* Changed from 22px to 24px */
    height: 24px;
    /* Changed from 22px to 24px */
    object-fit: contain;
    color: var(--accent);
}

.drawer-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}

/* Font Controls in Side Drawer */
.drawer-font-controls {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    padding: 15px 10px;
    border-top: 1px solid var(--border);
    background-color: var(--card);
    margin-top: auto;
    /* Pushes to bottom if flex container allows */
}

.font-control-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--fg);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
    font-family: inherit;
}

.font-control-btn:hover {
    background: var(--border);
}

.font-control-btn:active {
    transform: scale(0.95);
}

/* Theme Controls in Side Drawer */
.drawer-theme-controls {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    padding: 15px 10px;
    border-top: 1px solid var(--border);
    background-color: var(--card);
}

.theme-control-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--fg);
    border-radius: 50%;
    padding: 0;
    width: 44px;
    /* Slightly larger for easier tap */
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-control-btn:hover {
    background: var(--border);
}

.theme-control-btn:active {
    transform: scale(0.95);
}

.theme-control-btn.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}