/* =========================================================
   i-PISPA RESPONSIVE MOBILE PATCH
   Fail: asset/css/mobile.css
   Letak selepas CSS asal:
   <link rel="stylesheet" href="asset/css/mobile.css">
   ========================================================= */

.mobile-menu-toggle {
    display: none;
}

@media (max-width: 1024px) {
    body, html {
        min-height: 100vh;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .dashboard-wrapper {
        min-height: 100vh;
        height: auto;
    }

    .main-content {
        min-width: 0;
        overflow-x: hidden;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .bottom-layout {
        grid-template-columns: 1fr !important;
    }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.mobile-menu-ready .brand-section {
        justify-content: space-between !important;
        gap: 12px !important;
    }

    .mobile-menu-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: 1px solid rgba(255,255,255,0.16);
        border-radius: 12px;
        background: rgba(255,255,255,0.07);
        color: #fff;
        cursor: pointer;
        flex: 0 0 auto;
    }

    .mobile-menu-toggle span {
        display: block;
        width: 18px;
        height: 2px;
        border-radius: 999px;
        background: #fff;
        position: relative;
    }

    .mobile-menu-toggle span::before,
    .mobile-menu-toggle span::after {
        content: "";
        position: absolute;
        left: 0;
        width: 18px;
        height: 2px;
        border-radius: 999px;
        background: #fff;
    }

    .mobile-menu-toggle span::before { top: -6px; }
    .mobile-menu-toggle span::after { top: 6px; }

    .sidebar.mobile-menu-ready:not(.menu-open) .side-nav {
        display: none !important;
    }

    .sidebar.mobile-menu-ready.menu-open .side-nav {
        display: grid !important;
    }
}

@media (max-width: 768px) {
    body, html {
        width: 100%;
        min-height: 100vh;
        height: auto !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        background-attachment: scroll !important;
    }

    .dashboard-wrapper {
        display: block !important;
        width: 100%;
        min-height: 100vh;
        height: auto !important;
    }

    .sidebar {
        width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        position: relative !important;
        padding: 15px !important;
        border-right: none !important;
        border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.12));
        overflow: visible !important;
    }

    .brand-section {
        margin-bottom: 15px !important;
        justify-content: center !important;
    }

    .logo-img {
        width: 48px !important;
    }

    .brand-name {
        width: 120px !important;
        font-size: 1.1rem !important;
    }

    .brand-text,
    .nav-item span,
    .arrow {
        display: block !important;
    }

    .side-nav {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }

    .nav-item {
        margin-bottom: 0 !important;
        padding: 10px !important;
        font-size: 0.78rem !important;
        justify-content: center !important;
        text-align: center;
        border-left: none !important;
        border-bottom: 3px solid transparent;
    }

    .nav-item:hover,
    .nav-item.active {
        border-left: none !important;
        border-bottom-color: var(--accent-orange, #ff8c00);
    }

    .nav-link-group {
        justify-content: center !important;
        gap: 6px !important;
        flex-wrap: wrap;
    }

    .nav-link-group i,
    .nav-item i {
        width: 16px !important;
        height: 16px !important;
    }

    .nav-dropdown {
        width: 100% !important;
    }

    .dropdown-container {
        display: block !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        padding: 6px 0 0 !important;
        margin: 0 !important;
        background: transparent !important;
    }

    .dropdown-container a {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 34px !important;
        padding: 7px 8px !important;
        margin: 4px 0 0 !important;
        border-radius: 9px !important;
        font-size: 0.7rem !important;
        text-align: center !important;
        background: rgba(255,255,255,0.045) !important;
        color: rgba(255,255,255,0.76) !important;
    }

    .main-content {
        width: 100% !important;
        padding: 15px !important;
        min-height: auto !important;
        height: auto !important;
        overflow: visible !important;
    }

    .top-nav {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px;
        margin-bottom: 15px !important;
    }

    .breadcrumb,
    .user-status,
    .top-nav-right {
        font-size: 0.75rem !important;
    }

    .welcome-banner,
    .welcome-banner.glass {
        flex-direction: column !important;
        text-align: center !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 22px 16px !important;
        border-radius: 16px !important;
    }

    .banner-content h1,
    .welcome-banner h1 {
        font-size: 1.45rem !important;
        line-height: 1.25 !important;
    }

    .banner-content p,
    .welcome-banner p {
        font-size: 0.82rem !important;
        max-width: 100% !important;
    }

    .floating-icon,
    .banner-icon {
        display: none !important;
    }

    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        margin-bottom: 20px !important;
    }

    .card-body {
        padding: 18px !important;
        gap: 15px;
    }

    .info h2,
    .card-body h2 {
        font-size: 1.1rem !important;
        word-break: break-word;
    }

    .icon-box {
        width: 44px !important;
        height: 44px !important;
        flex-shrink: 0;
    }

    .bottom-layout {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .info-panel,
    .record-panel,
    .takwim-container,
    .takwim-container.glass-card {
        padding: 16px !important;
        border-radius: 16px !important;
    }

    .utility-grid {
        grid-template-columns: 1fr !important;
    }

    .wide-btn {
        grid-column: span 1 !important;
    }

    .util-btn {
        justify-content: center;
        font-size: 0.8rem !important;
        padding: 13px !important;
    }

    .virtual-card {
        height: auto !important;
        min-height: 220px;
        padding: 22px !important;
    }

    .card-bottom-row {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .personal-info-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-update-profile,
    .btn-save,
    .back-btn {
        width: 100%;
        justify-content: center;
    }

    .profile-img-wrapper,
    .profile-pic-large {
        margin: 0 auto;
    }

    .table-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .filter-box,
    .filter-box input {
        width: 100% !important;
    }

    .controls-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch !important;
    }

    .month-selector {
        width: 100%;
    }

    .table-wrapper {
        width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
    }

    .takwim-table {
        min-width: 760px !important;
        font-size: 0.78rem !important;
    }

    .takwim-table thead th,
    .takwim-table tbody td {
        padding: 12px 14px !important;
    }

    .floating-action-btn {
        right: 15px !important;
        bottom: 15px !important;
        padding: 10px 16px !important;
        font-size: 0.78rem !important;
    }

    .ai-chat-container {
        right: 15px !important;
        bottom: 15px !important;
    }

    .ai-floating-btn {
        width: 55px !important;
        height: 55px !important;
    }

    .chat-window {
        width: calc(100vw - 30px) !important;
        height: 70vh !important;
        max-height: 520px;
        margin-bottom: 12px !important;
    }

    .chat-messages {
        padding: 14px !important;
    }

    .msg {
        max-width: 90% !important;
        font-size: 0.78rem !important;
    }

    .modal-overlay,
    #viewModal {
        padding: 12px !important;
    }

    .contact-modal,
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 18px !important;
        max-height: 88vh;
        overflow-y: auto;
    }

    .contact-methods {
        grid-template-columns: 1fr !important;
    }

    .toast {
        left: 15px !important;
        right: 15px !important;
        top: 15px !important;
        width: auto !important;
        text-align: center;
    }

    .sidebar.mobile-menu-ready .brand-section {
        justify-content: space-between !important;
        gap: 12px !important;
    }

    .mobile-menu-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: 1px solid rgba(255,255,255,0.16);
        border-radius: 12px;
        background: rgba(255,255,255,0.07);
        color: #fff;
        cursor: pointer;
        flex: 0 0 auto;
    }

    .mobile-menu-toggle span {
        display: block;
        width: 18px;
        height: 2px;
        border-radius: 999px;
        background: #fff;
        position: relative;
    }

    .mobile-menu-toggle span::before,
    .mobile-menu-toggle span::after {
        content: "";
        position: absolute;
        left: 0;
        width: 18px;
        height: 2px;
        border-radius: 999px;
        background: #fff;
    }

    .mobile-menu-toggle span::before { top: -6px; }
    .mobile-menu-toggle span::after { top: 6px; }

    .sidebar.mobile-menu-ready:not(.menu-open) .side-nav {
        display: none !important;
    }

    .sidebar.mobile-menu-ready.menu-open .side-nav {
        display: grid !important;
    }
}

@media (max-width: 480px) {
    .side-nav {
        grid-template-columns: 1fr !important;
    }

    .nav-item {
        justify-content: flex-start !important;
        text-align: left;
    }

    .nav-link-group {
        justify-content: flex-start !important;
    }

    .welcome-banner,
    .welcome-banner.glass {
        padding: 18px 14px !important;
    }

    .banner-content h1,
    .welcome-banner h1 {
        font-size: 1.25rem !important;
    }

    .brand-name {
        width: 105px !important;
    }

    .logo-img {
        width: 42px !important;
    }

    .takwim-table {
        min-width: 700px !important;
    }

    .avatar-ring {
        width: 86px !important;
        height: 86px !important;
    }

    .avatar-ring img {
        width: 78px !important;
        height: 78px !important;
    }
}
