* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
}

/* Admin Wrapper - Sidebar Layout */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: white;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-header {
    padding: 24px 20px;
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar-logo {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-img {
    max-width: 100%;
    height: auto;
    max-height: 70px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.logo-img:hover {
    transform: scale(1.05);
}

.sidebar-nav {
    padding: 16px 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0 12px;
    border-radius: 10px 10px 0 0;
    position: relative;
    font-weight: 500;
}

.sidebar-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: 0 4px 4px 0;
}

.sidebar-item:hover {
    background: rgba(102, 126, 234, 0.15);
    color: #ffffff;
    transform: translateX(4px);
    border-left-color: #667eea;
}

.sidebar-item:hover::before {
    opacity: 1;
}

.sidebar-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.25) 100%);
    border-left-color: #667eea;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateX(0);
}

.sidebar-item.active::before {
    opacity: 1;
}

.sidebar-item.logout {
    color: #f87171;
    margin-top: 8px;
}

.sidebar-item.logout:hover {
    background: rgba(239, 68, 68, 0.15);
    border-left-color: #ef4444;
    color: #fee2e2;
}

.sidebar-item.logout::before {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.sidebar-item .icon {
    font-size: 22px;
    margin-right: 16px;
    width: 26px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.sidebar-item:hover .icon {
    transform: scale(1.1);
}

.sidebar-item.active .icon {
    transform: scale(1.15);
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.3));
}

.sidebar-item .text {
    font-size: 15px;
    letter-spacing: 0.2px;
}

.sidebar-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
    margin: 16px 24px;
    border: none;
}

/* Main Content Area */
.admin-main {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 18px 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.sidebar-toggle {
    display: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.sidebar-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.admin-header h1 {
    font-size: 26px;
    color: #1e293b;
    margin: 0;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.user-info {
    color: #475569;
    font-size: 15px;
    font-weight: 600;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 8px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.admin-content {
    flex: 1;
    padding: 30px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }
    
    .admin-main {
        margin-left: 260px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .admin-header {
        padding: 14px 20px;
    }
    
    .admin-header h1 {
        font-size: 20px;
    }
    
    .user-info {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .sidebar-header {
        padding: 20px 16px;
    }
    
    .logo-img {
        max-height: 55px;
    }
    
    .sidebar-item {
        padding: 12px 20px;
        margin: 2px 8px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }
    
    .admin-header h1 {
        font-size: 18px;
    }
    
    .sidebar-header {
        padding: 18px 12px;
    }
    
    .logo-img {
        max-height: 50px;
    }
    
    .sidebar-item {
        padding: 14px 16px;
        margin: 2px 4px;
    }
    
    .sidebar-item .text {
        font-size: 14px;
    }
}

/* Alert Styles */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Table Styles */
.table-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f8f9fa;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Badge Styles */
.badge {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}
.badge-active { background: #28a745; color: white; }
.badge-inactive { background: #6c757d; color: white; }
.badge-pending { background: #ffc107; color: #000; }
.badge-success { background: #28a745; color: white; }
.badge-warning { background: #ffc107; color: #000; }
.badge-info { background: #17a2b8; color: white; }
.badge-preparing { background: #fd7e14; color: white; }
.badge-shipped { background: #007bff; color: white; }
.badge-cancelled { background: #6c757d; color: white; }

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Form Styles */
.filters {
    margin-bottom: 20px;
}
.filters .btn {
    margin-right: 10px;
}
/* Form Styles */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.required {
    color: #dc3545;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #6c757d;
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-container {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h2 {
    font-size: 24px;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #6c757d;
    cursor: pointer;
    line-height: 1;
}

.modal-form {
    padding: 30px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e9ecef;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Section Styles */
.section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.stat-card h3 {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}
.stat-card .value {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
}

/* Shared status badges & empty state (products / variants / categories / attributes) */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active,
.status-active.status-active,
.status-badge.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive,
.status-inactive.status-inactive,
.status-badge.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.actions-col {
    width: 260px;
    text-align: right;
}

.actions-cell {
    text-align: right;
}

.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.inline-form {
    display: inline;
}

.empty-state {
    text-align: center;
    padding: 80px 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 2px dashed #e9ecef;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.7;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.empty-state h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 26px;
    font-weight: 700;
}

.empty-state p {
    color: #6c757d;
    margin-bottom: 24px;
    font-size: 15px;
    line-height: 1.6;
}

/* Product / category / attribute tables */
.products-content {
    min-height: 400px;
}

.id-cell {
    color: #6c757d;
    font-weight: 600;
    font-size: 13px;
    width: 80px;
}

.name-cell strong {
    display: block;
    color: #2c3e50;
    font-size: 15px;
    margin-bottom: 4px;
}

.name-cell small {
    display: block;
    color: #6c757d;
    font-size: 13px;
    line-height: 1.4;
}

.slug-cell code {
    font-size: 13px;
    padding: 3px 8px;
    background: #f8f9fa;
    border-radius: 6px;
    color: #495057;
}

.category-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: #e7f5ff;
    color: #0b7285;
    font-size: 13px;
    font-weight: 600;
}

/* Small action buttons used in tables */
.btn-action {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-action span {
    display: inline-flex;
    align-items: center;
}

.btn-edit,
.btn-action.btn-edit {
    background: #28a745;
    color: #ffffff;
}

.btn-edit:hover,
.btn-action.btn-edit:hover {
    background: #218838;
    transform: translateY(-1px);
}

.btn-delete,
.btn-action.btn-delete {
    background: #dc3545;
    color: #ffffff;
}

.btn-delete:hover,
.btn-action.btn-delete:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.btn-variants,
.btn-action.btn-variants {
    background: #f1f3f5;
    color: #343a40;
}

.btn-variants:hover,
.btn-action.btn-variants:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

/* Order View Page */
.order-view {
    max-width: 1100px;
    margin: 0 auto;
}
.order-view__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}
.order-view__title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}
.order-view__order-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}
.order-view__meta {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}
.order-view__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.order-view__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
@media (max-width: 900px) {
    .order-view__grid { grid-template-columns: 1fr; }
}
.order-view__card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
    padding: 20px;
}
.order-view__card--full {
    grid-column: 1 / -1;
}
.order-view__card-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
}
.order-view__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 6px 0;
    font-size: 14px;
    color: #374151;
}
.order-view__row + .order-view__row {
    border-top: 1px solid #f3f4f6;
}
.order-view__label {
    color: #6b7280;
    font-weight: 500;
}
.order-view__value {
    font-weight: 600;
    color: #111827;
}
.order-view__value--total {
    font-size: 1.1rem;
    color: #0f766e;
}
.order-view__block {
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}
.order-view__block--muted {
    color: #9ca3af;
}
.order-view__status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 4px 0;
}
.order-view__status-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.order-view__status-form select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 14px;
    min-width: 160px;
    background: #fff;
}
.order-view__btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.order-view__address {
    white-space: pre-line;
    font-size: 14px;
    color: #374151;
    line-height: 1.6;
}
.order-view__notes {
    font-size: 14px;
    color: #374151;
    line-height: 1.6;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

/* JSON Editor Modal Styles */
.json-editor-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.json-editor-overlay.show {
    display: flex;
}
.json-editor-container {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}
