/* ASH Techno - Web Based Inventory Management System */
/* Matching Android App UI */

:root {
    --primary-color: #2196F3;
    --primary-dark: #1976D2;
    --primary-light: #BBDEFB;
    --secondary-color: #FF9800;
    --success-color: #4CAF50;
    --danger-color: #F44336;
    --warning-color: #FFC107;
    --info-color: #00BCD4;
    --dark-color: #212121;
    --grey-100: #F5F5F5;
    --grey-200: #EEEEEE;
    --grey-300: #E0E0E0;
    --grey-400: #BDBDBD;
    --grey-500: #9E9E9E;
    --white: #FFFFFF;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.15);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--grey-100);
    color: var(--dark-color);
    overflow-x: hidden;
    max-width: 100vw;
}

/* Prevent zoom on input focus on mobile - use 16px to prevent iOS zoom */
input, select, textarea {
    font-size: 16px;
}

/* Ensure images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Ensure all containers don't overflow */
div, section, article {
    max-width: 100%;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary-dark) 0%, #1565C0 100%);
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    padding: 24px 20px;
    background: rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.sidebar-header p {
    font-size: 12px;
    opacity: 0.8;
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
}

.sidebar-menu li {
    margin: 2px 10px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: var(--white);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-size: 15px;
    font-weight: 500;
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.15);
}

.sidebar-menu a.active {
    background: var(--white);
    color: var(--primary-dark);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.sidebar-menu i {
    margin-right: 14px;
    width: 24px;
    text-align: center;
    font-size: 18px;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 10px 20px;
}

.sidebar-category {
    padding: 10px 20px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    background: var(--grey-100);
    max-width: calc(100% - 260px);
    overflow-x: hidden;
}

@media (max-width: 992px) {
    .main-content {
        max-width: 100%;
    }
}

/* Top Bar */
.top-bar {
    background: var(--white);
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Mobile Menu Toggle Button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--dark-color);
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
}

.menu-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--dark-color);
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.menu-toggle-btn:hover {
    background: var(--grey-200);
}

.menu-toggle-btn i {
    font-size: 22px;
}

.user-name {
    display: inline;
}

@media (max-width: 992px) {
    .menu-toggle-btn {
        display: flex;
    }
    
    .user-name {
        display: none;
    }
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-color);
    display: flex;
    align-items: center;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 16px;
}

/* Floating Button (FAB) */
.floating-btn {
    position: fixed !important;
    bottom: 24px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: #F44336 !important;
    color: white !important;
    border: none !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    font-size: 28px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 20px rgba(244, 67, 54, 0.5) !important;
    transition: all 0.3s ease !important;
    z-index: 99999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    line-height: 1 !important;
}

.floating-btn:hover {
    transform: translateX(-50%) scale(1.1) !important;
    box-shadow: 0 6px 25px rgba(244, 67, 54, 0.6) !important;
    background: #E53935 !important;
}

.floating-btn i {
    font-size: 28px !important;
    line-height: 1 !important;
}

/* Page Content */
.page-content {
    padding: 24px 30px;
    overflow-x: hidden;
    max-width: 100%;
}

/* Ensure all direct children don't overflow */
.page-content > * {
    max-width: 100%;
    overflow-x: hidden;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--grey-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-color);
}

.card-body {
    padding: 24px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary-color); }
.stat-icon.success { background: #E8F5E9; color: var(--success-color); }
.stat-icon.warning { background: #FFF3E0; color: var(--secondary-color); }
.stat-icon.danger { background: #FFEBEE; color: var(--danger-color); }
.stat-icon.info { background: #E0F7FA; color: var(--info-color); }

.stat-info h4 {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 14px;
    color: var(--grey-500);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.quick-action-btn:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.quick-action-btn i {
    font-size: 32px;
    margin-bottom: 10px;
}

.quick-action-btn span {
    font-size: 14px;
    font-weight: 500;
    color: var(--dark-color);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--grey-200);
}

.table th {
    font-weight: 600;
    color: var(--dark-color);
    background: var(--grey-100);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tr:hover {
    background: var(--grey-100);
}

.table td {
    font-size: 15px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-warning {
    background: var(--warning-color);
    color: var(--dark-color);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--grey-300);
    color: var(--dark-color);
}

.btn-outline:hover {
    background: var(--grey-100);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--grey-200);
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Search Box */
.search-box {
    position: relative;
    margin-bottom: 24px;
}

.search-box input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--grey-200);
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.search-box i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--grey-400);
    font-size: 18px;
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: #E8F5E9; color: var(--success-color); }
.badge-warning { background: #FFF3E0; color: var(--secondary-color); }
.badge-danger { background: #FFEBEE; color: var(--danger-color); }
.badge-primary { background: var(--primary-light); color: var(--primary-color); }
.badge-info { background: #E0F7FA; color: var(--info-color); }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex !important;
}

.modal-overlay.active + .floating-btn,
.modal-overlay.active ~ .floating-btn {
    display: none !important;
}

.modal {
    background: var(--white);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
    margin: auto;
    position: relative;
    display: block !important;
    visibility: visible !important;
}

.modal-body {
    display: block !important;
    visibility: visible !important;
    padding: 20px;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--grey-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--grey-500);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--grey-100);
    color: var(--dark-color);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--grey-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Filter Section */
.filter-section {
    background: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    overflow-x: hidden;
}

.filter-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-row .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 120px;
}

/* Mobile filter section */
@media (max-width: 576px) {
    .filter-section {
        padding: 12px;
    }
    
    .filter-row {
        gap: 10px;
    }
    
    .filter-row .form-group {
        min-width: 100%;
        flex: none;
        width: 100%;
    }
    
    .filter-row .btn {
        width: 100%;
    }
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--grey-200);
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    flex-wrap: nowrap;
}

.tabs::-webkit-scrollbar {
    height: 4px;
}

.tabs::-webkit-scrollbar-thumb {
    background: var(--grey-400);
    border-radius: 2px;
}

.tab {
    padding: 14px 24px;
    font-weight: 600;
    color: var(--grey-500);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    margin-bottom: -2px;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* POS Layout */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    min-height: calc(100vh - 200px);
}

.pos-products {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.pos-products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.pos-products-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.product-item {
    background: var(--white);
    border: 2px solid var(--grey-200);
    border-radius: var(--border-radius);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.product-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.product-item .name {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--dark-color);
}

.product-item .price {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 4px;
}

.product-item .stock {
    font-size: 12px;
    color: var(--grey-500);
}

.cart-panel {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--grey-200);
}

.cart-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.cart-items {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 0;
    border-bottom: 1px solid var(--grey-200);
    gap: 10px;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--grey-200);
}

.cart-item-row:last-child {
    border-bottom: none;
}

.cart-item-left {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-qty-price {
    color: var(--grey-500);
    font-size: 13px;
}

.cart-item-delete {
    padding: 4px 8px;
    color: #dc3545;
    border: none;
    background: transparent;
}

.cart-item-delete:hover {
    background: #ffeef0;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--grey-300);
    background: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: var(--transition);
}

.qty-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.cart-summary {
    border-top: 2px solid var(--grey-200);
    padding-top: 16px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 15px;
}

.cart-summary-row.total {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    padding-top: 12px;
    border-top: 1px solid var(--grey-200);
    margin-top: 12px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--grey-400);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    display: block;
}

.empty-state p {
    font-size: 16px;
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--grey-200);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 3000;
}

.toast {
    background: var(--white);
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-success { border-left: 4px solid var(--success-color); }
.toast-error { border-left: 4px solid var(--danger-color); }
.toast-warning { border-left: 4px solid var(--warning-color); }

/* Mobile Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    /* Mobile Menu Toggle Button */
    .menu-toggle {
        display: flex !important;
    }
    
    .pos-container {
        grid-template-columns: 1fr;
    }
    
    .cart-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: var(--border-radius) var(--border-radius) 0 0;
        max-height: 60vh;
        overflow-y: auto;
        z-index: 1000;
    }
    
    /* Ensure page content allows horizontal scroll for tables */
    .page-content {
        overflow-x: auto;
        max-width: 100vw;
    }
    
    /* Cards full width on mobile */
    .card {
        max-width: 100%;
    }
    
    .card.sale-card {
        overflow: visible !important;
    }
    
    /* Sales grid scrollable on mobile */
    .sales-grid {
        overflow-x: visible !important;
    }
    
    /* Sale product table scrollable on mobile */
    .sale-product-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -10px;
        padding: 0 10px;
    }
    
    .sale-product-table {
        min-width: 300px;
    }
    
    /* Filter section mobile */
    .filter-section {
        max-width: 100%;
    }
    
    /* Tabs scrollable on mobile */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Tables scrollable on mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Tablet Responsive */
@media (min-width: 577px) and (max-width: 768px) {
    .page-content {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sidebar {
        width: 240px;
    }
    
    .top-bar {
        padding: 12px 20px;
    }
    
    .page-title {
        font-size: 20px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .page-content {
        padding: 12px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .top-bar {
        padding: 10px 12px;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .sidebar-menu a {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .sidebar-menu i {
        margin-right: 10px;
        font-size: 16px;
    }
    
    /* Tabs scrollable on small mobile */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    /* Filter section full width on small mobile */
    .filter-section {
        padding: 10px;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .filter-row .form-group {
        width: 100%;
    }
    
    /* Card adjustments */
    .card {
        padding: 12px;
    }
    
    .card-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    /* Summary cards stack on small mobile - sales page */
    .row .col-md-3 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 576px) {
    .page-content {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table th, .table td {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    /* Form controls full width */
    .form-control {
        width: 100%;
    }
    
    /* Button full width on mobile */
    .btn {
        width: 100%;
    }
    
    /* Filter section full width */
    .filter-section {
        max-width: 100%;
    }
    
    /* Tables horizontal scroll */
    .table-container {
        overflow-x: auto;
    }
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
    }
    
    .form-control {
        min-height: 44px;
        padding: 10px 14px;
    }
    
    .sidebar-menu a {
        padding: 16px 16px;
    }
    
    .checkbox-wrapper, .radio-wrapper {
        min-height: 44px;
        padding: 10px 0;
    }
}

/* Better table scrolling on mobile */
@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    .dataTables_wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Improved modal on mobile */
@media (max-width: 576px) {
    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-body {
        padding: 16px;
    }
}

/* Print Styles */
@media print {
    .sidebar, .top-bar, .btn, .modal-overlay, .toast-container {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
}
