/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #e4e6ea;
    background-color: #0f1419;
    font-size: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    color: #e4e6ea;
    padding: 0.75rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #2d3748;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 60px;
}

.logo {
    font-size: 1.25rem;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
}

.nav a {
    color: #e4e6ea;
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
    white-space: nowrap;
    font-size: 0.9rem;
    text-align: center;
}

.nav a:hover,
.nav a.active {
    background-color: rgba(45, 55, 72, 0.4);
    color: #4c9ae1;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
    font-size: 0.9rem;
}

/* Enhanced Navigation Dropdown Styles */
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #e4e6ea;
    text-decoration: none;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.nav-item:hover,
.nav-item.active,
.nav-item.touch-hover {
    background-color: rgba(76, 154, 225, 0.1);
    color: #4c9ae1;
    border-color: rgba(76, 154, 225, 0.2);
    box-shadow: 0 2px 8px rgba(76, 154, 225, 0.1);
}

.nav-icon {
    font-size: 1rem;
    opacity: 0.9;
}

.nav-text {
    font-weight: 500;
    letter-spacing: 0.025em;
}

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #e4e6ea;
    text-decoration: none;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
}

.nav-dropdown-toggle:hover,
.nav-dropdown-toggle.active,
.nav-dropdown-toggle.touch-hover {
    background-color: rgba(76, 154, 225, 0.1);
    color: #4c9ae1;
    border-color: rgba(76, 154, 225, 0.2);
    box-shadow: 0 2px 8px rgba(76, 154, 225, 0.1);
}

.dropdown-arrow {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    opacity: 0.7;
}

.nav-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    border: 1px solid rgba(76, 154, 225, 0.2);
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    padding: 0.5rem 0;
    backdrop-filter: blur(10px);
}

.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-menu.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

.nav-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #e4e6ea;
    text-decoration: none;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
    background-color: rgba(76, 154, 225, 0.1);
    color: #4c9ae1;
    border-left-color: #4c9ae1;
    transform: translateX(3px);
}

.menu-icon {
    font-size: 1rem;
    opacity: 0.8;
    width: 1.2rem;
    text-align: center;
}

.menu-separator {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(76, 154, 225, 0.3) 50%,
        transparent 100%
    );
    margin: 0.5rem 1rem;
}

/* Mobile hamburger menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #e4e6ea;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.mobile-menu-toggle:hover {
    background-color: rgba(45, 55, 72, 0.4);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    z-index: 200;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100%;
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    z-index: 201;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.5);
    border-right: 1px solid #2d3748;
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(45, 55, 72, 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(26, 32, 44, 0.6);
}

.mobile-menu-close {
    background: none;
    border: none;
    color: #e4e6ea;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
}

.mobile-menu-close:hover {
    background-color: rgba(45, 55, 72, 0.4);
}

.mobile-nav {
    padding: 1rem 0;
}

.mobile-nav-section {
    margin-bottom: 1rem;
}

.mobile-nav-section.admin-only {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    margin-top: 1.5rem;
}

.mobile-nav-subsection {
    margin: 0.5rem 0;
    padding-left: 1rem;
}

.mobile-nav-subheader {
    padding: 0.3rem 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
    border-left: 2px solid #95a5a6;
}

.mobile-nav-header {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4c9ae1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(76, 154, 225, 0.1);
    border-left: 3px solid #4c9ae1;
    margin-bottom: 0.5rem;
}

.mobile-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #e4e6ea;
    text-decoration: none;
    padding: 0.75rem 1rem 0.75rem 1.5rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.mobile-nav-section .mobile-nav a {
    padding-left: 2rem;
}

.mobile-nav-subsection a {
    padding-left: 3rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.mobile-nav a:hover,
.mobile-nav a.active {
    background-color: rgba(76, 154, 225, 0.1);
    color: #4c9ae1;
    border-left-color: #4c9ae1;
    transform: translateX(3px);
}

.mobile-user-info {
    padding: 1rem;
    border-top: 1px solid rgba(45, 55, 72, 0.4);
    background-color: rgba(26, 32, 44, 0.6);
}

.mobile-user-info span {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Login Form */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
}

.login-form {
    background: #1a202c;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    width: 100%;
    max-width: 400px;
    border: 1px solid #2d3748;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #e4e6ea;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #a0aec0;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #2d3748;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    background-color: #0f1419;
    color: #e4e6ea;
}

.form-control:focus {
    outline: none;
    border-color: #4c9ae1;
    box-shadow: 0 0 5px rgba(76, 154, 225, 0.3);
}

.form-control:disabled {
    background-color: #1a202c;
    color: #718096;
    cursor: not-allowed;
}

.form-control[readonly] {
    background-color: #1a202c;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #2d3748;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

/* File input specific styling - fixes mobile file selection issues */
input[type="file"].form-control {
    padding: 0.5rem;
    background-color: #2d3748;
    border: 2px dashed #4c9ae1;
    cursor: pointer;
    position: relative;
}

input[type="file"].form-control:focus {
    border-color: #63b3ed;
    box-shadow: 0 0 0 3px rgba(76, 154, 225, 0.1);
}

input[type="file"].form-control::-webkit-file-upload-button {
    background: #4c9ae1;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 0.5rem;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

input[type="file"].form-control::-webkit-file-upload-button:hover {
    background: #3182ce;
}

/* Firefox file input styling */
input[type="file"].form-control::-moz-file-upload-button {
    background: #4c9ae1;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

/* Enhanced file input wrapper for better mobile experience */
.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-input-wrapper .file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-input-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px dashed #4c9ae1;
    border-radius: 8px;
    background-color: #2d3748;
    color: #e4e6ea;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 60px;
}

.file-input-wrapper:hover .file-input-label {
    border-color: #63b3ed;
    background-color: #374151;
}

.file-input-label .file-icon {
    font-size: 1.5rem;
}

.file-input-label .file-text {
    font-weight: 500;
}

/* File selected state */
.file-input:not(:placeholder-shown) + .file-input-label,
.file-input-wrapper.has-file .file-input-label {
    border-color: #48bb78;
    background-color: #1a2e1a;
    color: #9ae6b4;
}

.file-input-wrapper.has-file .file-icon {
    color: #48bb78;
}

/* Better mobile form inputs */
@media (max-width: 768px) {
    .form-control {
        padding: 0.875rem;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 8px;
    }
    
    select.form-control {
        padding: 0.875rem 0.75rem;
    }
    
    textarea.form-control {
        min-height: 80px;
    }
    
    /* Mobile file input fixes */
    input[type="file"].form-control {
        padding: 1rem;
        font-size: 16px;
        border: 2px solid #4c9ae1;
        border-radius: 8px;
        background-color: #2d3748;
        color: #e4e6ea;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        cursor: pointer;
    }
    
    input[type="file"].form-control::-webkit-file-upload-button {
        -webkit-appearance: none;
        appearance: none;
        background: #4c9ae1;
        color: white;
        border: none;
        padding: 0.75rem 1rem;
        border-radius: 6px;
        cursor: pointer;
        margin-right: 0.75rem;
        font-size: 16px;
        font-weight: 500;
    }
    
    /* Alternative mobile file input styling */
    input[type="file"].form-control::file-selector-button {
        background: #4c9ae1;
        color: white;
        border: none;
        padding: 0.75rem 1rem;
        border-radius: 6px;
        cursor: pointer;
        margin-right: 0.75rem;
        font-size: 16px;
        font-weight: 500;
    }
    
    /* Enhanced mobile file input wrapper */
    .file-input-wrapper {
        position: relative;
        touch-action: manipulation;
    }
    
    .file-input-wrapper .file-input-label {
        padding: 1.5rem;
        font-size: 16px;
        min-height: 80px;
        -webkit-tap-highlight-color: rgba(76, 154, 225, 0.2);
    }
    
    .file-input-wrapper .file-icon {
        font-size: 2rem;
    }
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.4);
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.btn-success:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
}

.btn-small, .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-full {
    width: 100%;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
}

.badge-info {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
}

.badge-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.badge-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.badge-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

.page-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #e4e6ea;
    text-align: center;
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #2d3748;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.dashboard-card h3 {
    color: #a0aec0;
    margin-bottom: 1rem;
    font-weight: 600;
}

.dashboard-card .number {
    font-size: 3rem;
    font-weight: bold;
    color: #4c9ae1;
    margin-bottom: 0.5rem;
}

/* Tables */
.table-container {
    background: #1a202c;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    margin-bottom: 2rem;
    border: 1px solid #2d3748;
}

.table-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    border-bottom: 1px solid #4a5568;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-header h3 {
    color: #e4e6ea;
    margin: 0;
    font-weight: 600;
}

.table-header-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #1a202c;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #2d3748;
    color: #e4e6ea;
}

.table th {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    font-weight: 600;
    color: #e4e6ea;
    border-bottom: 2px solid #4a5568;
}

.table tbody tr {
    transition: background-color 0.2s;
}

.table tbody tr:hover {
    background-color: #233042;
}

/* Sales table sent away checkbox styles */
input[type="checkbox"][id*="sent_away_"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #48bb78;
    transform: scale(1.1);
    margin: 0 auto;
    display: block;
}

input[type="checkbox"][id*="sent_away_"]:hover {
    transform: scale(1.2);
    transition: transform 0.2s ease;
    box-shadow: 0 0 8px rgba(72, 187, 120, 0.5);
}

input[type="checkbox"][id*="sent_away_"]:checked {
    background-color: #48bb78;
}

/* Style for non-pending invoice sent away indicators */
.text-muted {
    color: #a0aec0 !important;
    font-size: 0.9em;
}

/* Restructured Inventory Page Styles */
.filters {
    background: #1a202c;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid #2d3748;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #e4e6ea;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 0.375rem;
    color: #e4e6ea;
    font-size: 0.875rem;
}

.form-control:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.form-control:disabled {
    background-color: #2d3748;
    opacity: 0.6;
}

textarea.form-control {
    resize: vertical;
    min-height: 2.5rem;
}

/* Grid layouts for forms */
.modal-content form > div[style*="grid"] {
    margin-bottom: 1rem;
}

/* Responsive grid adjustments */
@media (max-width: 768px) {
    .filters {
        grid-template-columns: 1fr !important;
    }
    
    .modal-content form > div[style*="grid"] {
        grid-template-columns: 1fr !important;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #1a202c;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.3s;
    border: 1px solid #2d3748;
    color: #e4e6ea;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #2d3748;
}

.modal-header h3 {
    margin: 0;
    color: #e4e6ea;
}

.close {
    color: #a0aec0;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.close:hover {
    color: #e4e6ea;
}

/* Filters and Search */
.filters {
    background: #1a202c;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
    border: 1px solid #2d3748;
}

.filter-row {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
    border-left: 4px solid;
}

.alert-success {
    background-color: #1a2e1a;
    border-color: #48bb78;
    color: #9ae6b4;
}

.alert-error {
    background-color: #2d1b1b;
    border-color: #f56565;
    color: #feb2b2;
}

.alert-warning {
    background-color: #2d2a1a;
    border-color: #ed8936;
    color: #fbd38d;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Alternative compact mobile header layout */
@media (max-width: 640px) {
    .header-content {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .logo {
        order: 1;
        flex: 0 0 auto;
    }
    
    .user-info {
        order: 2;
        flex: 0 0 auto;
    }
    
    .nav {
        order: 3;
        width: 100%;
        flex: 1 1 100%;
        margin-top: 0.5rem;
        gap: 0.2rem;
    }
    
    .nav a {
        flex: 1;
        min-width: 0;
        padding: 0.4rem 0.3rem;
        font-size: 0.75rem;
        text-align: center;
    }
}
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem;
    }
    
    .filter-row {
        gap: 0.75rem;
    }
    
    .nav {
        gap: 0.75rem;
    }


/* Large Desktop Responsive Design */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
        padding: 0 30px;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    .table th,
    .table td {
        padding: 1.25rem;
    }
    
    .modal-content {
        max-width: 800px;
    }
}

/* Form Responsiveness */
.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .form-row .form-group {
        min-width: auto;
    }
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .table th,
    .table td {
        min-height: 44px;
    }
    
    .nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    /* Compact mobile header */
    .header {
        padding: 0.5rem 0;
    }
    
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        min-height: 50px;
    }
    
    .logo {
        font-size: 1.1rem;
        order: 1;
    }
    
    /* Hide desktop navigation on mobile */
    .nav {
        display: none;
    }
    
    /* Hide desktop user info on mobile */
    .user-info {
        display: none;
    }
    
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: block;
        order: 3;
    }
    
    .page-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .dashboard-card {
        padding: 1.5rem;
    }
    
    .table-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 0.5rem;
        padding: 1rem;
    }

    .table-header-buttons {
        justify-content: center;
    }
    
    .table-header h3 {
        margin-bottom: 0.5rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
        padding: 1.5rem;
        max-height: 90vh;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-small {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        width: auto;
        margin-bottom: 0;
    }
    
    /* Better touch targets on mobile */
    .table-responsive {
        font-size: 0.9rem;
        overflow-x: visible !important; /* Force no horizontal scroll */
    }
    
    /* Universal table mobile optimization - applies to ALL tables */
    .table {
        min-width: 100% !important; /* Remove horizontal scroll requirement */
        display: block;
        overflow-x: visible;
    }
    
    .table thead {
        display: none; /* Hide table headers on mobile */
    }
    
    .table tbody {
        display: block;
    }
    
    .table tbody tr {
        display: block;
        background: #1a202c;
        border: 2px solid #2d3748;
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 12px;
        position: relative;
    }
    
    .table tbody tr:hover {
        background: #233042;
        border-color: #4c9ae1;
    }
    
    .table tbody td {
        display: block;
        padding: 6px 0;
        border: none;
        font-size: 14px;
        line-height: 1.4;
        position: relative;
        padding-left: 90px; /* Space for labels */
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Add labels before each data cell using CSS content */
    .table tbody td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 0;
        top: 6px;
        font-weight: 600;
        color: #a0aec0;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        width: 80px;
    }
    
    /* Fallback labels for tables without data-label attributes */
    .table tbody td:nth-child(1):before { content: "Item: "; }
    .table tbody td:nth-child(2):before { content: "Details: "; }
    .table tbody td:nth-child(3):before { content: "Info: "; }
    .table tbody td:nth-child(4):before { content: "Value: "; }
    .table tbody td:nth-child(5):before { content: "Extra: "; }
    .table tbody td:nth-child(6):before { content: "Action: "; }
    
    /* Special styling for pricing/monetary values */
    .table tbody td:nth-child(4),
    .table tbody td:nth-child(5) {
        font-weight: 600;
        color: #4ade80;
        font-size: 15px;
    }
    
    /* Action buttons styling */
    .table tbody td:last-child {
        padding-top: 10px;
    }
    
    .table tbody td:last-child .btn {
        margin: 2px;
        padding: 6px 10px;
        font-size: 11px;
        min-height: 32px;
        display: inline-block;
        white-space: nowrap;
    }
    
    /* Compact management actions */
    .management-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .management-actions .btn {
        padding: 10px 6px;
        font-size: 11px;
    }
    
    /* Ultra-compact stats grid */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .main-content {
        padding: 0.75rem 0;
    }
    
    .container {
        padding: 0 10px;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* Ultra-compact header for small phones */
    .header {
        padding: 0.4rem 0;
    }
    
    .header-content {
        gap: 0.3rem;
    }
    
    .logo {
        font-size: 1rem;
    }
    
    .nav {
        gap: 0.1rem;
        max-width: 100%;
    }
    
    .nav a {
        padding: 0.3rem 0.4rem;
        font-size: 0.75rem;
        min-width: 60px;
        border-radius: 3px;
    }
    
    .user-info {
        font-size: 0.75rem;
        gap: 0.25rem;
    }
    
    .user-info span {
        display: none; /* Hide "Welcome, admin" text on very small screens */
    }
    
    .dashboard-card .number {
        font-size: 2rem;
    }
    
    .table-container {
        margin: 0 -10px 2rem;
        border-radius: 0;
        background: #1a202c;
        overflow: visible !important;
    }
    
    .page-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .modal-content {
        margin: 2% auto;
        width: 98%;
        padding: 1rem;
        max-height: 96vh;
    }
    
    .form-control {
        padding: 0.875rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn {
        padding: 0.875rem 1rem;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .dashboard-card {
        padding: 1rem;
    }
    
    /* Enhanced ultra-small screen table optimization */
    .table {
        min-width: 100% !important;
        width: 100% !important;
        display: block;
        overflow: visible !important;
        border-collapse: separate;
    }
    
    .table-responsive {
        overflow: visible !important;
        overflow-x: visible !important;
        -webkit-overflow-scrolling: auto;
    }
    
    .table thead {
        display: none !important;
    }
    
    .table tbody {
        display: block;
        width: 100%;
    }
    
    .table tbody tr {
        display: block;
        background: #1a202c;
        border: 1px solid #2d3748;
        border-radius: 8px;
        margin-bottom: 10px;
        padding: 12px;
        position: relative;
        width: 100%;
        box-sizing: border-box;
    }
    
    .table tbody td {
        display: block;
        padding: 4px 0;
        border: none;
        font-size: 13px;
        line-height: 1.4;
        position: relative;
        padding-left: 80px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
        box-sizing: border-box;
        white-space: normal;
    }
    
    .table tbody td:before {
        width: 70px;
        font-size: 10px;
        top: 4px;
        left: 0;
        position: absolute;
        font-weight: 600;
        color: #a0aec0;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        word-wrap: break-word;
    }
    
    /* Compact action buttons for ultra-small screens */
    .table tbody td .btn {
        margin: 1px;
        padding: 4px 8px;
        font-size: 10px;
        min-height: 28px;
        display: inline-block;
        white-space: nowrap;
    }
    
    /* Ultra-compact management actions */
    .management-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .management-actions .btn {
        padding: 8px 4px;
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Ultra-compact stats grid */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .stat-card {
        padding: 8px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .stat-label {
        font-size: 9px;
    }
    
    /* Better filter controls for small screens */
    .filter-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-row .form-control {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Improve table headers for small screens */
    .table-header {
        padding: 0.75rem;
        flex-direction: column;
        gap: 8px;
    }
    
    .table-header h3 {
        font-size: 1rem;
        margin-bottom: 0;
    }
    
    .table-header-buttons {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    /* Ensure no content overflows */
    * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Fix any remaining overflow issues */
    .table-container,
    .table-responsive,
    .table,
    .table tbody,
    .table tbody tr,
    .table tbody td {
        max-width: 100% !important;
        overflow-x: visible !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: #48bb78; }
.text-warning { color: #ed8936; }
.text-danger { color: #f56565; }
.text-primary { color: #4c9ae1; }
.text-secondary { color: #a0aec0; }
.text-muted { color: #718096; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }

.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.hidden { display: none; }
.visible { display: block; }

/* Print Styles */
@media print {
    .header,
    .filters,
    .modal,
    .btn {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .table-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Out of Stock Styling */
select option:disabled {
    color: #666 !important;
    font-style: italic;
}

.out-of-stock-info {
    background-color: #4a1f1f !important;
    border: 1px solid #8b0000;
    color: #ff6b6b;
}

.out-of-stock-info strong {
    color: #ff6b6b;
}

/* Beautiful Confirmation Modal */
.confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.confirm-modal-overlay.show {
    display: flex;
}

.confirm-modal {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    max-width: 450px;
    width: 90%;
    margin: 20px;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
    border: 1px solid #4a5568;
}

.confirm-modal-header {
    padding: 24px 24px 16px 24px;
    text-align: center;
}

.confirm-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
}

.confirm-modal-icon.danger {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
}

.confirm-modal-icon.warning {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.confirm-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #e4e6ea;
    margin-bottom: 8px;
}

.confirm-modal-body {
    padding: 0 24px 24px 24px;
    text-align: center;
}

.confirm-modal-message {
    color: #a0aec0;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.confirm-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-modal-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.confirm-modal-button.primary {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
}

.confirm-modal-button.primary:hover {
    background: linear-gradient(135deg, #c53030 0%, #9c2626 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.confirm-modal-button.secondary {
    background: #4a5568;
    color: #e4e6ea;
    border: 1px solid #718096;
}

.confirm-modal-button.secondary:hover {
    background: #718096;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 85, 104, 0.3);
}

.confirm-modal-button:active {
    transform: translateY(0);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile responsive for modal */
@media (max-width: 480px) {
    .confirm-modal {
        margin: 10px;
        max-width: none;
    }
    
    .confirm-modal-buttons {
        flex-direction: column;
    }
    
    .confirm-modal-button {
        width: 100%;
    }
}

/* CSV Upload Styles */
.progress {
    background-color: #2d3748;
    border-radius: 5px;
    height: 20px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #4CAF50, #45a049);
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.alert {
    padding: 15px;
    margin: 10px 0;
    border-radius: 5px;
    border: 1px solid;
}

.alert-success {
    background-color: #1b4d3e;
    border-color: #4CAF50;
    color: #68d391;
}

.alert-danger {
    background-color: #4a1e1e;
    border-color: #f56565;
    color: #feb2b2;
}

.alert h5 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.alert ul {
    margin: 5px 0;
    padding-left: 20px;
}

.alert li {
    margin: 3px 0;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 15px;
}

@media (max-width: 768px) {
    .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

details {
    margin-top: 10px;
}

summary {
    cursor: pointer;
    padding: 5px;
    background-color: #2d3748;
    border-radius: 3px;
    margin-bottom: 10px;
}

summary:hover {
    background-color: #4a5568;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.p-3 {
    padding: 1rem;
}

/* Collapsible functionality */
.collapsible-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.table-header > div {
    display: flex;
    gap: 10px;
    align-items: center;
}

@media (max-width: 768px) {
    .table-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .table-header > div {
        justify-content: center;
    }
}

/* Button improvements */
.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: #fff;
}

.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid #6c757d;
    color: #6c757d;
}

.btn-outline:hover {
    background-color: #6c757d;
    color: #fff;
}

/* Page title improvements */
.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 768px) {
    .page-title {
        flex-direction: column;
        text-align: center;
    }
    
    .page-title button {
        margin-left: 0 !important;
    }
}

/* Deletion Modal Styles */
.deletion-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
}

.deletion-modal-content {
    background-color: #1a202c;
    border: 1px solid #2d3748;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.deletion-modal-header {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.deletion-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.deletion-modal-header .close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: white;
}

.deletion-modal-header .close:hover {
    opacity: 0.8;
}

.deletion-modal-body {
    padding: 20px;
    color: #e4e6ea;
}

.sample-items {
    background-color: #2d3748;
    border-radius: 5px;
    padding: 15px;
    margin: 15px 0;
}

.sample-items h4 {
    margin: 0 0 10px 0;
    color: #fbb6ce;
}

.sample-items ul {
    margin: 0;
    padding-left: 20px;
}

.sample-items li {
    margin: 5px 0;
}

.deletion-options {
    margin-top: 20px;
}

.deletion-options h4 {
    color: #68d391;
    margin-bottom: 20px;
}

.option-group {
    background-color: #2d3748;
    border-radius: 5px;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #4299e1;
}

.option-group h5 {
    margin: 0 0 10px 0;
    color: #90cdf4;
}

.option-group p {
    margin: 10px 0;
    line-height: 1.5;
}

.warning-text {
    color: #feb2b2 !important;
    font-weight: bold;
}

.option-group button {
    margin-top: 10px;
    margin-right: 10px;
}

.option-group select {
    margin: 10px 0;
    width: 100%;
}

@media (max-width: 768px) {
    .deletion-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .deletion-modal-header {
        padding: 12px 15px;
    }
    
    .deletion-modal-body {
        padding: 15px;
    }
}

/* CSV Upload Section Styles */
.csv-upload-section {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #4a5568;
}

.csv-upload-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.file-input-label {
    display: inline-block;
    padding: 10px 15px;
    background: #4a5568;
    color: #e4e6ea;
    border-radius: 5px;
    border: 2px dashed #718096;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.file-input-label:hover {
    background: #2d3748;
    border-color: #a0aec0;
}

.file-input-label.has-file {
    border-color: #48bb78;
    background: #2f855a;
}

.upload-progress {
    margin-top: 15px;
}

.progress {
    background-color: #2d3748;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #48bb78, #38a169);
    height: 100%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.upload-results .alert {
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
}

.alert-success {
    background-color: rgba(72, 187, 120, 0.1);
    border: 1px solid #48bb78;
    color: #68d391;
}

.alert-danger {
    background-color: rgba(245, 101, 101, 0.1);
    border: 1px solid #f56565;
    color: #fc8181;
}

.csv-instructions {
    background-color: #1a202c;
    border: 1px solid #2d3748;
    border-radius: 5px;
    padding: 15px;
}

.csv-instructions h5 {
    color: #e4e6ea;
    margin-bottom: 10px;
}

.csv-instructions ul {
    margin-left: 20px;
}

.csv-instructions li {
    margin-bottom: 5px;
}

.csv-example {
    background-color: #2d3748;
    padding: 10px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    margin: 10px 0;
    white-space: pre-line;
}

.btn-upload {
    background: linear-gradient(135deg, #3182ce, #2b77cb);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-upload:hover {
    background: linear-gradient(135deg, #2b77cb, #2a69ac);
    transform: translateY(-1px);
}

.btn-download-sample {
    background: linear-gradient(135deg, #805ad5, #6b46c1);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-download-sample:hover {
    background: linear-gradient(135deg, #6b46c1, #553c9a);
    transform: translateY(-1px);
}

/* Samsung S25 Specific Optimizations */
/* Target Samsung Galaxy S25 viewport dimensions */
@media screen and (max-width: 430px) and (min-height: 844px) {
    /* Enhanced viewport handling for S25 */
    html {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    body {
        font-size: 16px;
        line-height: 1.5;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Improved header for S25 dimensions */
    .header {
        padding: 12px 0;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(45, 55, 72, 0.8);
    }
    
    .header-content {
        min-height: 56px;
        padding: 0 20px;
        justify-content: space-between;
        align-items: center;
    }
    
    .logo {
        font-size: 1.2rem;
        font-weight: 700;
    }
    
    /* Enhanced mobile menu for S25 */
    .mobile-menu {
        width: min(350px, 82vw);
        border-radius: 0 20px 20px 0;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    }
    
    .mobile-menu-header {
        padding: 20px;
        background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    }
    
    .mobile-nav a {
        padding: 18px 24px;
        font-size: 16px;
        font-weight: 500;
        min-height: 60px;
        display: flex;
        align-items: center;
        transition: all 0.3s ease;
    }
    
    .mobile-nav a:hover {
        transform: translateX(4px);
    }
    
    /* Enhanced buttons for S25 touch */
    .btn {
        min-height: 48px;
        padding: 14px 20px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 10px;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    .btn:active {
        transform: scale(0.97);
    }
    
    /* Better form controls for S25 */
    .form-control {
        min-height: 52px;
        padding: 16px 18px;
        font-size: 16px;
        border-radius: 10px;
        border: 2px solid #2d3748;
        background-color: #1a202c;
        transition: all 0.3s ease;
    }
    
    .form-control:focus {
        border-color: #4c9ae1;
        background-color: #0f1419;
        box-shadow: 0 0 0 4px rgba(76, 154, 225, 0.15);
    }
    
    /* Enhanced table responsiveness for S25 - Universal for all tables */
    .table-container {
        border-radius: 12px;
        overflow: hidden;
        margin: 20px 0;
    }
    
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        overflow-x: visible !important; /* Remove horizontal scroll */
    }
    
    /* Universal mobile-first responsive table for ALL pages */
    .table {
        min-width: 100% !important; /* Override any min-width constraints */
        display: block;
        overflow-x: visible;
        width: 100%;
    }
    
    .table thead {
        display: none; /* Hide table headers on mobile */
    }
    
    .table tbody {
        display: block;
        width: 100%;
    }
    
    .table tbody tr {
        display: block;
        background: #1a202c;
        border: 2px solid #2d3748;
        border-radius: 12px;
        margin-bottom: 16px;
        padding: 16px;
        position: relative;
        width: 100%;
        box-sizing: border-box;
    }
    
    .table tbody tr:hover {
        background: #233042;
        border-color: #4c9ae1;
    }
    
    .table tbody td {
        display: block;
        padding: 8px 0;
        border: none;
        font-size: 15px;
        line-height: 1.5;
        position: relative;
        padding-left: 120px; /* Space for labels */
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Enhanced labels for better mobile experience */
    .table tbody td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 0;
        top: 8px;
        font-weight: 600;
        color: #a0aec0;
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        width: 110px;
        word-wrap: break-word;
    }
    
    /* Universal fallback labels for all table types */
    .table tbody td:nth-child(1):before { content: "Item: "; }
    .table tbody td:nth-child(2):before { content: "Details: "; }
    .table tbody td:nth-child(3):before { content: "Info: "; }
    .table tbody td:nth-child(4):before { content: "Price: "; }
    .table tbody td:nth-child(5):before { content: "Value: "; }
    .table tbody td:nth-child(6):before { content: "Actions: "; }
    .table tbody td:nth-child(7):before { content: "Extra: "; }
    .table tbody td:nth-child(8):before { content: "More: "; }
    
    /* Enhanced pricing/monetary value styling */
    .table tbody td:nth-child(4),
    .table tbody td:nth-child(5) {
        font-weight: 600;
        color: #4ade80;
        font-size: 16px;
    }
    
    /* Better action buttons styling */
    .table tbody td:nth-child(6),
    .table tbody td:last-child {
        padding-top: 12px;
    }
    
    .table tbody td .btn {
        margin: 2px;
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
        display: inline-block;
        white-space: nowrap;
    }
    
    /* Special handling for no-data messages */
    .table tbody tr td.no-data-message,
    .table tbody tr td[colspan] {
        display: table-cell !important;
        padding: 2rem !important;
        text-align: center;
        border-radius: 12px;
        background: #2d3748;
        color: #a0aec0 !important;
        padding-left: 2rem !important;
    }
    
    .table tbody tr td.no-data-message:before,
    .table tbody tr td[colspan]:before {
        display: none;
    }
    
    /* Improved modals for S25 */
    .modal-content {
        width: 92vw;
        max-width: 380px;
        max-height: 85vh;
        border-radius: 16px;
        margin: 0 auto;
        top: 10vh;
        position: relative;
    }
    
    /* Enhanced dashboard cards */
    .dashboard-card {
        padding: 24px;
        border-radius: 16px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        transition: all 0.3s ease;
    }
    
    .dashboard-card:active {
        transform: scale(0.98);
    }
    
    /* Better spacing and typography */
    .page-title {
        font-size: 1.75rem;
        font-weight: 700;
        margin-bottom: 24px;
        line-height: 1.2;
    }
    
    .main-content {
        padding: 20px 0;
    }
    
    .container {
        padding: 0 20px;
    }
}

/* Samsung S25 Portrait orientation optimizations */
@media screen and (max-width: 430px) and (orientation: portrait) and (min-height: 800px) {
    /* Enhanced management actions for pricing page */
    .management-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin: 20px 0;
    }
    
    .management-actions .btn {
        padding: 12px 8px;
        font-size: 13px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Better filter controls for pricing */
    .filter-row {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    
    .filter-row .form-group {
        flex: 1;
    }
    
    .filter-row .form-group label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
        color: #a0aec0;
    }
    
    .filter-row .form-control {
        width: 100%;
        min-height: 48px;
        padding: 12px 16px;
        font-size: 16px;
        border-radius: 8px;
    }
    
    /* Stats grid for pricing summary */
    .stats-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        margin: 20px 0;
    }
    
    .stat-card {
        background: #2d3748;
        padding: 20px;
        border-radius: 12px;
        text-align: center;
        border: 2px solid #4a5568;
    }
    
    .stat-value {
        font-size: 24px;
        font-weight: 700;
        color: #4ade80;
        margin-bottom: 8px;
    }
    
    .stat-label {
        font-size: 12px;
        color: #a0aec0;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Enhanced pricing modal for S25 */
    .modal-content {
        width: 95vw;
        max-width: 400px;
        max-height: 90vh;
        border-radius: 16px;
        margin: 5vh auto;
    }
    
    .modal-content .form-row {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    
    .modal-content .form-group {
        flex: 1;
    }
    
    .modal-content .form-control {
        min-height: 48px;
        font-size: 16px;
        padding: 12px 16px;
    }
    
    .modal-content textarea {
        min-height: 100px;
        resize: vertical;
    }
    
    .modal-footer {
        display: flex;
        gap: 12px;
        margin-top: 24px;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-height: 48px;
        font-size: 16px;
    }
    /* Optimize vertical space usage */
    .header {
        position: sticky;
        top: 0;
        z-index: 1000;
    }
    
    /* Better content spacing */
    .dashboard-grid {
        gap: 20px;
        margin-bottom: 24px;
    }
    
    /* Improved filter sections */
    .filters {
        padding: 20px;
        border-radius: 12px;
        margin-bottom: 24px;
    }
    
    .filter-row {
        gap: 16px;
    }
    
    /* Enhanced table headers */
    .table-header {
        padding: 20px;
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .table-header h3 {
        font-size: 1.25rem;
        font-weight: 600;
        text-align: center;
    }
    
    .table-header-buttons {
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
    }
}

/* Samsung S25 Landscape orientation optimizations */
@media screen and (max-height: 430px) and (orientation: landscape) and (min-width: 800px) {
    /* Compact header for landscape */
    .header {
        padding: 8px 0;
    }
    
    .header-content {
        min-height: 48px;
    }
    
    /* Compact content spacing */
    .main-content {
        padding: 16px 0;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 16px;
    }
    
    .dashboard-card {
        padding: 20px;
    }
    
    /* Compact modals */
    .modal-content {
        max-height: 75vh;
        width: 85vw;
        max-width: 600px;
    }
    
    /* Horizontal form layouts */
    .form-row {
        flex-direction: row;
        gap: 16px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
}

/* Samsung AMOLED display optimizations */
@media screen and (max-width: 430px) and (color-gamut: p3) {
    /* True black for AMOLED power savings */
    body {
        background-color: #000000;
    }
    
    .header {
        background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
        border-bottom: 1px solid #2a2a2a;
    }
    
    .dashboard-card,
    .table-container,
    .modal-content {
        background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
        border: 1px solid #2a2a2a;
    }
    
    /* Better contrast for AMOLED */
    .form-control {
        background-color: #0a0a0a;
        border-color: #2a2a2a;
    }
    
    .form-control:focus {
        background-color: #000000;
    }
}

/* Samsung Internet Browser specific fixes */
@supports (-webkit-touch-callout: none) {
    @media screen and (max-width: 430px) {
        /* Fix viewport issues in Samsung Internet */
        .container {
            max-width: 100vw;
            overflow-x: hidden;
        }
        
        /* Better select styling */
        select.form-control {
            -webkit-appearance: none;
            appearance: none;
            background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23e4e6ea' viewBox='0 0 16 16'%3E%3Cpath d='M8 13.1l-8-8 2.1-2.1L8 9.1l5.9-6.1L16 5.1z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 16px center;
            background-size: 16px;
            padding-right: 48px;
        }
        
        /* Fix touch scrolling */
        .table-responsive,
        .modal-content {
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
        }
    }
}

/* Samsung One UI gesture navigation support */
@media screen and (max-width: 430px) {
    /* Add safe area padding for gesture navigation */
    .main-content {
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
    
    /* Adjust sticky elements */
    .header {
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }
    
    /* Modal positioning with safe areas */
    .modal {
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    
    /* Button positioning at bottom */
    .sticky-bottom {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
}

/* Performance optimizations for Samsung S25 */
@media screen and (max-width: 430px) {
    /* Enable hardware acceleration */
    .header,
    .mobile-menu,
    .dashboard-card,
    .modal-content {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: transform;
    }
    
    /* Optimize animations for 120Hz displays */
    * {
        animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
        transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Reduce motion for better performance when requested */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
            scroll-behavior: auto !important;
        }
    }
    
    /* Optimize scroll performance */
    .table-responsive,
    .modal-content {
        scroll-behavior: smooth;
        overscroll-behavior: contain;
    }
}

/* Medium screens - tablet adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
    .nav {
        gap: 0.15rem;
    }
    
    .nav-item,
    .nav-dropdown-toggle {
        padding: 0.5rem 0.7rem;
        font-size: 0.85rem;
    }
    
    .nav-dropdown-menu {
        min-width: 200px;
    }
    
    .nav-dropdown-menu a {
        padding: 0.65rem 0.9rem;
        font-size: 0.85rem;
    }
}

/* Global Mobile Table Fix - Applies to ALL mobile devices */
@media (max-width: 768px) {
    /* Navigation responsive fixes */
    .nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .header-content {
        justify-content: space-between;
    }
    
    .nav-dropdown-menu {
        display: none !important;
    }
    
    /* Force all tables to be mobile-friendly */
    .table-responsive {
        overflow-x: visible !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: auto !important;
    }
    
    .table {
        min-width: 100% !important;
        width: 100% !important;
        table-layout: auto !important;
        overflow: visible !important;
    }
    
    /* Ensure no element can cause horizontal overflow */
    * {
        max-width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    /* Specific fixes for common problematic elements */
    pre, code {
        white-space: pre-wrap !important;
        word-break: break-all !important;
    }
    
    /* Container and content area fixes */
    .container,
    .main-content,
    .table-container {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    
    /* Action buttons in tables - ensure they wrap properly */
    .action-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .action-buttons .btn {
        flex: 1;
        min-width: 60px;
        font-size: 11px;
        padding: 6px 8px;
    }
}

/* Universal no-scroll enforcement for all screen sizes */
body {
    overflow-x: hidden !important;
}

html {
    overflow-x: hidden !important;
}

.btn-download-sample:hover {
    background: linear-gradient(135deg, #6b46c1, #553c9a);
    transform: translateY(-1px);
}

/* Pricing Stats Cards */
.stat-card {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    border-radius: 8px;
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #4a5568;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #4c9ae1;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* Management Actions for Pricing */
.management-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1rem;
}

.management-actions .btn {
    flex: 1;
    min-width: 150px;
}

/* Pricing Column Toggle Styles */
.pricing-column {
    transition: opacity 0.3s ease, width 0.3s ease;
}

.pricing-column.hidden {
    display: none !important;
}

#pricing-toggle-btn {
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .management-actions .btn {
        min-width: 100%;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
    
    /* Stack pricing toggle button on mobile */
    .page-title div {
        flex-wrap: wrap;
        gap: 5px;
    }
}

/* Search Section Styles */
.search-section {
    background: rgba(45, 55, 72, 0.3);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #4a5568;
    margin-bottom: 1rem;
}

.search-section input[type="text"] {
    background-color: #2d3748;
    border: 1px solid #4a5568;
    color: #e4e6ea;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 200px;
}

.search-section input[type="text"]:focus {
    outline: none;
    border-color: #63b3ed;
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
}

.search-section input[type="text"]::placeholder {
    color: #a0aec0;
    font-style: italic;
}

.search-section .btn {
    white-space: nowrap;
    min-width: auto;
}

.search-section .d-flex {
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .search-section .d-flex {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-section input[type="text"] {
        max-width: none;
        width: 100%;
    }
    
    .search-section .btn {
        width: 100%;
        justify-content: center;
    }
}
