/* =====================================================================
   ADMIN MOBILE — off-canvas drawer + responsive tables
   Loaded after admin.css so it overrides the existing media query rules.
   ===================================================================== */

/* ─── Top bar (mobile only, hidden by default) ─── */
.kt-admin-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 54px;
    background: #2c3e50;
    color: #fff;
    z-index: 90;
    align-items: center;
    padding: 0 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.kt-admin-burger {
    background: transparent;
    border: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.kt-admin-burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}
.kt-admin-burger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.kt-admin-burger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.kt-admin-burger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.kt-admin-topbar__title {
    font-family: Georgia, serif;
    font-size: 16px;
    font-weight: 600;
    color: #fff !important;
    text-decoration: none !important;
    flex: 1;
    margin-left: 6px;
    line-height: 1;
}
.kt-admin-topbar__title small {
    color: #c0392b;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: block;
    margin-top: 2px;
}

.kt-admin-topbar__view {
    color: rgba(255,255,255,.8) !important;
    text-decoration: none !important;
    font-size: 18px;
    padding: 0 12px;
    line-height: 44px;
    flex-shrink: 0;
}
.kt-admin-topbar__view:hover { color: #fff !important; }

/* ─── Overlay (only visible when drawer is open) ─── */
.kt-admin-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 95;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
}
.kt-admin-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

body.kt-admin-noscroll { overflow: hidden; }

/* =====================================================================
   MOBILE BREAKPOINT (≤ 900px)
   ===================================================================== */
@media (max-width: 900px) {
    /* Show the top bar */
    .kt-admin-topbar { display: flex; }

    /* Push body content down below top bar */
    body.kt-admin { padding-top: 54px; }

    /* Sidebar becomes a left-side drawer */
    .kt-admin-sidebar {
        position: fixed !important;
        top: 54px !important;
        left: 0 !important;
        bottom: 0;
        width: 270px !important;
        height: calc(100vh - 54px) !important;
        background: #2c3e50;
        transform: translateX(-100%);
        transition: transform .25s ease;
        overflow-y: auto;
        z-index: 100;
        box-shadow: 2px 0 12px rgba(0,0,0,.25);
    }
    .kt-admin-sidebar.is-open { transform: translateX(0); }

    /* Hide the desktop logo at the top of the sidebar (since topbar already has it) */
    .kt-admin-sidebar .kt-admin-logo { display: none; }

    /* Make sidebar items easier to tap */
    .kt-admin-sidebar li a {
        padding: 14px 20px !important;
        font-size: 14px !important;
    }
    .kt-admin-sep { padding: 18px 20px 8px !important; }
    .kt-admin-user { padding: 18px 20px !important; }
    .kt-admin-user button, .kt-admin-user a { padding: 6px 0; font-size: 13px; }

    /* Main content takes full width */
    .kt-admin-main {
        margin-left: 0 !important;
        padding: 14px !important;
        min-height: calc(100vh - 54px);
    }

    /* ─── Page heading + button ─── */
    .kt-page-head {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 12px;
    }
    .kt-page-head h1 {
        font-size: 22px !important;
        margin: 0 !important;
    }

    /* ─── Tables: compact mode ─── */
    .kt-table {
        font-size: 13px;
        border: 1px solid var(--kt-admin-border);
        border-radius: 6px;
        overflow: hidden;
    }
    .kt-table thead { display: none; }
    .kt-table tr {
        display: block;
        border-bottom: 1px solid var(--kt-admin-border);
        padding: 10px 12px;
    }
    .kt-table tr:last-child { border-bottom: 0; }
    .kt-table td {
        display: block;
        padding: 4px 0 !important;
        border: 0 !important;
        font-size: 13px;
    }
    .kt-table td:first-child {
        font-weight: 600;
        font-size: 14px;
        margin-bottom: 4px;
    }
    .kt-table td:first-child a {
        color: var(--kt-admin-text);
        text-decoration: none;
    }
    .kt-table td:first-child a:hover { color: var(--kt-admin-red); }

    /* Action buttons go inline in a row */
    .kt-table .kt-table-actions {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 8px;
        padding-top: 8px !important;
        border-top: 1px solid var(--kt-admin-border) !important;
    }
    .kt-table .kt-table-actions a,
    .kt-table .kt-table-actions button {
        display: inline-block;
        padding: 5px 10px;
        font-size: 12px;
        border: 1px solid var(--kt-admin-border-strong);
        border-radius: 4px;
        background: #fff;
        color: var(--kt-admin-text) !important;
        text-decoration: none;
        cursor: pointer;
        font: inherit;
    }
    .kt-table .kt-table-actions form { display: inline; }
    .kt-table .kt-table-actions .kt-linkbtn.danger {
        color: var(--kt-admin-red) !important;
        border-color: #e0a0a0;
    }

    /* Status badges keep their pill look but smaller */
    .kt-status {
        display: inline-block;
        padding: 2px 8px;
        font-size: 11px;
    }

    /* ─── Filters bar ─── */
    .kt-filters {
        flex-wrap: wrap !important;
        font-size: 13px;
    }
    .kt-filters > div:first-child {
        flex: 1 1 100%;
        margin-bottom: 8px;
    }
    .kt-filters .kt-postsearch {
        margin-left: 0 !important;
        flex: 1 1 100%;
        flex-direction: row;
    }
    .kt-filters .kt-postsearch input[type=search] {
        min-width: 0 !important;
        flex: 1;
    }

    /* ─── Forms: stack everything ─── */
    .kt-form-grid,
    .kt-two-col,
    .kt-form-row {
        grid-template-columns: 1fr !important;
        flex-direction: column !important;
    }
    .kt-fieldset { padding: 14px !important; margin-bottom: 14px; }
    .kt-fieldset legend { font-size: 13px; }

    .kt-field input,
    .kt-field textarea,
    .kt-field select,
    input[type=text], input[type=email], input[type=password],
    input[type=number], input[type=search], input[type=url],
    input[type=date], input[type=datetime-local], input[type=time],
    textarea, select {
        font-size: 16px !important;  /* iOS zoom prevention */
        padding: 10px 12px !important;
    }

    /* Buttons larger for finger taps */
    .kt-btn,
    button[type=submit],
    .kt-btn-primary {
        padding: 10px 16px !important;
        font-size: 14px !important;
        min-height: 40px;
    }

    /* ─── Stats grid (dashboard) ─── */
    .kt-stats { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
    .kt-stat { padding: 12px !important; }
    .kt-stat .kt-stat-num { font-size: 22px !important; }

    /* ─── Two-column layouts (post edit) ─── */
    .kt-edit-layout,
    .kt-two-col,
    .kt-form-grid {
        display: block !important;
    }

    /* Sidebar fieldsets in post edit go full width */
    aside.kt-edit-side,
    .kt-edit-side {
        width: 100% !important;
        margin-top: 14px;
    }

    /* Jodit editor mobile fixes */
    .jodit-container {
        font-size: 14px;
    }
    .jodit-toolbar__box {
        flex-wrap: wrap;
    }

    /* Flash messages */
    .kt-flash {
        margin-bottom: 12px;
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* ─── Very small phones ─── */
@media (max-width: 480px) {
    .kt-admin-main { padding: 10px !important; }
    .kt-page-head h1 { font-size: 19px !important; }
    .kt-stats { grid-template-columns: 1fr !important; }
    .kt-table tr { padding: 8px 10px; }

    .kt-admin-sidebar { width: calc(100vw - 50px) !important; }
}

/* ─── Override the OLD mobile rules from admin.css (lines 412-416) ─── */
/* Those rules made the sidebar `position: static` which broke the drawer. */
@media (max-width: 720px) {
    .kt-admin-sidebar {
        position: fixed !important;
        width: 270px !important;
        height: calc(100vh - 54px) !important;
    }
    .kt-admin-main {
        margin-left: 0 !important;
    }
}
