:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #333;
    --text-muted: #6c757d;
    --sidebar-width: 250px;
    --header-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--light-bg);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-color);
    color: #fff;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-item.active {
    background-color: var(--secondary-color);
    color: #fff;
}

.nav-icon {
    margin-right: 10px;
    font-size: 16px;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.main-header {
    background-color: #fff;
    padding: 0 30px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.main-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.content {
    padding: 30px;
}

.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

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

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

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

.alert-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
}

.alert-close:hover {
    opacity: 1;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: #2980b9;
}

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

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

.btn-danger {
    background-color: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 6px 10px;
}

.card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-control.error {
    border-color: var(--danger-color);
}

.form-error {
    color: var(--danger-color);
    font-size: 12px;
    margin-top: 4px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--light-bg);
    font-weight: 600;
    color: var(--text-color);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.table tbody tr:last-child td {
    border-bottom: none;
}

.product-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    background-color: var(--light-bg);
}

.product-image-placeholder {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-bg);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 20px;
}

.stock-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.stock-ok {
    background-color: #d4edda;
    color: #155724;
}

.stock-low {
    background-color: #f8d7da;
    color: #721c24;
}

.stock-over {
    background-color: #fff3cd;
    color: #856404;
}

.action-btns {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
}

.action-btn.edit {
    background-color: #e3f2fd;
    color: var(--secondary-color);
}

.action-btn.edit:hover {
    background-color: var(--secondary-color);
    color: #fff;
}

.action-btn.delete {
    background-color: #fce4e4;
    color: var(--danger-color);
}

.action-btn.delete:hover {
    background-color: var(--danger-color);
    color: #fff;
}

.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-input {
    width: 100%;
    padding: 10px 12px;
    padding-left: 35px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
}

.filter-group {
    min-width: 150px;
}

.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

.pagination svg {
    width: 16px;
    height: 16px;
    max-width: 20px;
    max-height: 20px;
}

.pagination a:hover {
    background-color: var(--light-bg);
}

.pagination .active {
    background-color: var(--secondary-color);
    color: #fff;
    border-color: var(--secondary-color);
}

.pagination .disabled {
    color: var(--text-muted);
    pointer-events: none;
}

.pagination a:first-child,
.pagination a:last-child {
    padding: 6px 10px;
}

.report-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.report-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 24px;
    text-align: center;
    transition: box-shadow 0.2s;
}

.report-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.report-card-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.report-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.report-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.image-preview {
    width: 100px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    position: relative;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview .remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background-color: var(--danger-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    border: 2px solid #fff;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-grid .full-width {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar-header h1,
    .sidebar-nav .nav-item span:not(.nav-icon) {
        display: none;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .filters-bar {
        flex-direction: column;
    }
    
    .table th:nth-child(4),
    .table td:nth-child(4),
    .table th:nth-child(5),
    .table td:nth-child(5) {
        display: none;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label {
    cursor: pointer;
    user-select: none;
}

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

.file-input-wrapper input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background-color: var(--light-bg);
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.file-input-btn:hover {
    border-color: var(--secondary-color);
    background-color: #e3f2fd;
}

.text-muted {
    color: var(--text-muted);
}

.text-danger {
    color: var(--danger-color);
}

.mb-3 {
    margin-bottom: 15px;
}

.mt-3 {
    margin-top: 15px;
}

.text-right {
    text-align: right;
}

.sidebar-footer {
    margin-top: auto;
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    margin-bottom: 10px;
    padding: 10px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 6px;
}

.user-name {
    display: block;
    font-weight: 500;
    font-size: 14px;
    color: #fff;
}

.user-email {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    margin-top: 2px;
}

.logout-btn {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

.kpi-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        overflow: hidden;
    }
    
    .sidebar-header h1,
    .sidebar-nav .nav-item span:not(.nav-icon),
    .sidebar-footer .user-info {
        display: none;
    }
    
    .sidebar-nav .nav-item {
        justify-content: center;
        padding: 12px;
    }
    
    .sidebar-nav .nav-item .nav-icon {
        margin-right: 0;
        font-size: 20px;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .main-header {
        padding: 0 15px;
    }
    
    .content {
        padding: 15px;
    }
    
    .report-cards {
        grid-template-columns: 1fr;
    }
}