/**
 * shell-responsive styles (Wave D residual)
 */

/* --- styles.css L4799-L5129 --- */
/* === Mobile Responsiveness === */

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.mobile-menu-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
    /* Header Layout */
    .app-header {
        padding: 0 0 0 12px;
        position: relative;
        justify-content: space-between;
    }

    .mobile-menu-btn {
        display: flex;
        order: 3; /* Place after brand */
    }

    .header-user {
        order: 2;
        display: none !important;
    }

    .notification-dropdown {
        position: fixed;
        top: auto;
        right: 8px;
        left: 8px;
        bottom: 68px;
        width: auto;
        max-height: 60vh;
        border-radius: var(--border-radius-lg);
    }

    .notification-list {
        max-height: calc(60vh - 60px);
    }

    .header-brand {
        order: 1;
    }

    /* Worker + Direktur/HC hamburger stays account-only on 390. */
    body.mobile-drawer-account-only #app-sidebar #sidebar-company-brand,
    body.mobile-drawer-account-only #app-sidebar #sidebar-nav,
    body.mobile-drawer-account-only #app-sidebar #sidebar-help-link,
    body.mobile-drawer-account-only #app-sidebar .sidebar-group,
    body.mobile-drawer-account-only #app-sidebar .sidebar-nav-item {
        display: none !important;
    }

    body.mobile-drawer-account-only #app-sidebar .sidebar-user-menu {
        display: block !important;
    }

    .persona-white-collar #app-sidebar .sidebar-footer,
    .persona-blue-collar #app-sidebar .sidebar-footer {
        margin-top: auto;
    }

    /* Navigation */
    .tab-nav {
        display: none !important; /* Hidden by default, overridden by .active */
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        flex-direction: column;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        z-index: 999;
        margin: 0;
    }

    .tab-nav.active {
        display: flex !important;
        animation: slideDown 0.3s ease-out;
    }

    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .tab-btn {
        width: 100%;
        text-align: left;
        padding: 12px 24px;
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
        margin: 0;
    }

    .tab-btn:last-child {
        border-bottom: none;
    }

    .tab-btn.active {
        background-color: var(--brand-tint-10, rgba(var(--brand-color-rgb), 0.1));
        border-left: 4px solid var(--brand-color);
    }

    /* Dashboard Grid */
    .dashboard-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "content";
    }

    .app-container {
        padding: 16px;
    }

    /* Sub Navigation */
    .sub-nav {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 8px;
        justify-content: flex-start;
        margin-bottom: 16px;
        -webkit-overflow-scrolling: touch;
    }

    .sub-nav::-webkit-scrollbar {
        height: 4px;
    }

    .sub-nav::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 4px;
    }

    /* Stats Cards */
    .stats-grid, .user-stats-bar {
        grid-template-columns: 1fr; /* Stack cards */
        display: grid;
        gap: 16px;
    }

    .stat-item {
        width: 100%;
        min-width: auto;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        margin: 10px auto;
        max-height: 90vh;
        padding: 16px;
    }

    .modal-actions {
        flex-direction: column-reverse; /* Stack buttons, cancel at bottom usually or primary top */
        gap: 12px;
    }

    .modal-actions button {
        width: 100%;
    }

    /* Forms */
    .form-group {
        margin-bottom: 16px;
    }

    .form-row {
        flex-direction: column;
        gap: 16px;
    }

    /* Tables */
    .table-wrapper {
        margin-bottom: 24px;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }

    th, td {
        padding: 10px;
        font-size: 0.85rem;
    }

    /* Hide less important columns on mobile if needed, or rely on scroll */

    /* Filter Bars */
    .filter-bar, .user-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        width: 100%;
        min-width: auto;
    }

    .filter-group {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    /* === Responsive Tables (Card View) === */
    /* Force table to not be like tables anymore */
    table, thead, tbody, th, td, tr {
        display: block;
    }

    /* Hide table headers (but not display: none;, for accessibility) */
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        margin-bottom: 16px;
        background: var(--bg-card);
        box-shadow: var(--shadow);
    }

    td {
        /* Behave like a "row" */
        border: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        padding: 12px 16px !important;
        text-align: right;
        display: flex;
        justify-content: space-between;
        align-items: center;
        min-height: 48px;
    }

    td:last-child {
        border-bottom: none;
    }

    td::before {
        /* Now like a table header */
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        text-align: left;
        padding-right: 16px;
        flex: 1;
        max-width: 40%;
    }

    /* Content cell styling */
    td > *:not(::before) {
        flex: 1;
        display: flex;
        justify-content: flex-end;
        text-align: right;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Specific adjustments */
    td[data-label="Aksi"] {
        justify-content: flex-end;
        padding-top: 16px !important;
        padding-bottom: 16px !important;
        background-color: rgba(0,0,0,0.1);
    }

    /* Remove table wrapper border/scroll since we are stacking */
    .table-wrapper {
        border: none;
        overflow-x: visible;
        background: transparent;
    }

    /* Fix badges in card view */
    .badge {
        display: inline-block;
    }
}

@media (max-width: 480px) and (hover: none) and (pointer: coarse) {
    .app-container {
        padding: 10px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .section-header-actions {
        width: 100%;
    }

    .section-header-actions .btn,
    .section-header-actions button {
        width: 100%;
    }
}

