/*
 * ============================================================
 * TRIPURA - Mobile Responsive (< 768px)
 * ============================================================
 */

@media (max-width: 767.98px) {
    :root {
        --sidebar-width: 280px;
        --header-height: 58px;
        --topbar-height: var(--header-height);
    }

    /* Hide sidebar by default */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s var(--ease-smooth);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* Show overlay */
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    /* Adjust content */
    .content-wrapper {
        margin-left: 0;
        margin-top: var(--header-height);
        min-width: 0 !important;
        overflow-x: hidden !important;
    }

    /* Topbar */
    .topbar {
        left: 0;
        padding: 0 16px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .page-title {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px; /* Limit width to avoid overlapping icons */
    }

    .topbar-left {
        gap: 10px;
        min-width: 0; /* Allow truncation */
    }

    .user-info {
        display: none;
    }

    .user-dropdown-toggle {
        padding: 6px;
    }

    /* Content */
    .content-body {
        padding: 18px;
    }

    /* Cards */
    .card,
    .glass-card {
        border-radius: var(--radius-lg);
    }

    .card-body {
        padding: 18px;
    }

    .card-header {
        padding: 16px 18px;
    }

    /* Stat cards */
    .stat-card {
        padding: 1rem !important;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .search-container {
        max-width: 100%;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    /* Quick actions */
    .quick-action {
        padding: 18px 14px;
    }

    .quick-action i {
        font-size: 1.3rem;
    }

    .quick-action span {
        font-size: 0.75rem;
    }

    /* Tables */
    .table-responsive {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 1rem;
        position: relative;
    }

    .table {
        min-width: 600px;
    }

    .table thead th,
    .table tbody td {
        padding: 12px 14px;
        font-size: 0.8rem;
    }

    /* Buttons */
    .btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }

    .btn-sm {
        padding: 6px 14px;
        font-size: 0.78rem;
    }

    /* Forms */
    .form-control,
    .form-select {
        padding: 12px 16px;
        font-size: 0.875rem;
    }

    .input-group .form-control {
        padding-left: 44px;
    }

    /* Modals - full screen */
    .modal-dialog {
        margin: 12px;
        max-width: calc(100% - 24px);
    }

    .modal-content {
        border-radius: var(--radius-xl);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 18px 20px;
    }

    /* Login */
    .login-card {
        padding: 32px 24px;
        margin: 16px;
        max-width: none;
        border-radius: var(--radius-xl);
    }

    .login-logo img {
        height: 56px;
    }

    .login-title {
        font-size: 1.35rem;
    }

    /* Footer */
    .footer {
        padding: 14px 18px;
    }

    /* Toast */
    .toast-container {
        left: 16px;
        right: 16px;
        top: 16px;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* Tablet: 768px - 1023px */
@media (min-width: 768px) and (max-width: 1023.98px) {
    :root {
        --sidebar-width: 230px;
    }

    .sidebar-logo-text {
        font-size: 1.2rem;
    }

    .menu-link {
        font-size: 0.85rem;
        padding: 11px 14px;
    }

    .content-body {
        padding: 22px 26px;
    }

    .stat-value {
        font-size: 1.6rem;
    }

    .page-title {
        font-size: 1.1rem;
    }
}

/* Product Traceability (Mobile) */
@media (max-width: 576px) {
    .scan-bar {
        flex-direction: column;
    }

    .scan-bar button {
        width: 100%;
    }

    .info-grid {
        grid-template-columns: 1fr 1fr;
    }
}
