/* Variables CSS para panel de administración */
:root {
    --admin-primary: #3b82f6;
    --admin-secondary: #10b981;
    --admin-danger: #ef4444;
    --admin-warning: #f59e0b;
    --admin-info: #06b6d4;
    --admin-bg: #f8fafc;
    --admin-surface: #ffffff;
    --admin-text: #1f2937;
    --admin-text-light: #6b7280;
    --admin-border: #e5e7eb;
    --admin-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --sidebar-width: 280px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--admin-bg);
    color: var(--admin-text);
    line-height: 1.6;
}

/* Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--admin-surface);
    box-shadow: var(--admin-shadow);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--admin-border);
}

.sidebar-header h2 {
    color: var(--admin-primary);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    color: var(--admin-text-light);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--admin-bg);
    color: var(--admin-primary);
    border-left-color: var(--admin-primary);
}

.nav-item.logout {
    margin-top: auto;
    color: var(--admin-danger);
}

.nav-item.logout:hover {
    background-color: #fef2f2;
    color: var(--admin-danger);
    border-left-color: var(--admin-danger);
}

.nav-item i {
    width: 20px;
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--admin-border);
}

.content-header h1 {
    font-size: 2rem;
    color: var(--admin-text);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.welcome-text {
    color: var(--admin-text-light);
}

/* Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--admin-surface);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--admin-shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-card:nth-child(1) .stat-icon { background-color: var(--admin-primary); }
.stat-card:nth-child(2) .stat-icon { background-color: var(--admin-secondary); }
.stat-card:nth-child(3) .stat-icon { background-color: var(--admin-warning); }
.stat-card:nth-child(4) .stat-icon { background-color: var(--admin-info); }

.stat-content h3 {
    font-size: 2rem;
    font-weight: bold;
    color: var(--admin-text);
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--admin-text-light);
    font-size: 0.9rem;
}

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

.dashboard-card {
    background-color: var(--admin-surface);
    border-radius: 12px;
    box-shadow: var(--admin-shadow);
    overflow: hidden;
}

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

.card-header h3 {
    color: var(--admin-text);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-all-btn {
    color: var(--admin-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.view-all-btn:hover {
    text-decoration: underline;
}

.card-content {
    padding: 1.5rem;
}

.empty-state {
    text-align: center;
    color: var(--admin-text-light);
    font-style: italic;
}

/* Low Stock List */
.low-stock-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.low-stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--admin-bg);
    border-radius: 8px;
}

.product-name {
    font-weight: 500;
}

.stock-count {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.stock-count.warning {
    background-color: #fef3c7;
    color: #92400e;
}

.stock-count.critical {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Orders List */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--admin-bg);
    border-radius: 8px;
}

.order-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.order-id {
    font-weight: bold;
    color: var(--admin-primary);
}

.customer-name {
    font-size: 0.9rem;
    color: var(--admin-text-light);
}

.order-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.order-total {
    font-weight: bold;
}

.order-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.status-pending { background-color: #fef3c7; color: #92400e; }
.status-confirmed { background-color: #dbeafe; color: #1e40af; }
.status-shipped { background-color: #ecfdf5; color: #047857; }
.status-delivered { background-color: #d1fae5; color: #065f46; }
.status-cancelled { background-color: #fee2e2; color: #991b1b; }

/* Quick Actions */
.quick-actions {
    background-color: var(--admin-surface);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--admin-shadow);
}

.quick-actions h3 {
    margin-bottom: 1rem;
    color: var(--admin-text);
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background-color: var(--admin-primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-card {
    background-color: var(--admin-surface);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.login-header {
    text-align: center;
    padding: 2rem;
    background-color: var(--admin-primary);
    color: white;
}

.login-header i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.error-message {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.login-form {
    padding: 2rem;
}

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

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--admin-text);
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.login-btn {
    width: 100%;
    background-color: var(--admin-primary);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-btn:hover {
    background-color: #2563eb;
}

.login-footer {
    padding: 1rem 2rem;
    background-color: var(--admin-bg);
    text-align: center;
}

.login-footer a {
    color: var(--admin-text-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.login-footer a:hover {
    color: var(--admin-primary);
}

/* Form Styles */
.form-container {
    background-color: var(--admin-surface);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--admin-shadow);
    margin-bottom: 1.5rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.checkbox-row {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 1rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--admin-text);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
    background-color: var(--admin-bg);
    color: var(--admin-text);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Galería de Imágenes */
.gallery-section {
    background-color: var(--admin-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--admin-border);
    margin: 1rem 0;
}

.gallery-section > label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--admin-text);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gallery-section > label::before {
    content: "📸";
    font-size: 1.2rem;
}

.image-upload-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    align-items: start;
}

.main-image-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 150px;
    height: 150px;
    border: 2px dashed var(--admin-primary);
    border-radius: 12px;
    background-color: rgba(59, 130, 246, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--admin-primary);
}

.upload-label:hover {
    background-color: rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.upload-label i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.upload-label span {
    font-size: 0.9rem;
    font-weight: 500;
}

.current-image {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--admin-shadow);
}

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

.image-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
}

.additional-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.image-upload-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.upload-label-small {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    border: 2px dashed var(--admin-border);
    border-radius: 8px;
    background-color: var(--admin-surface);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--admin-text-light);
}

.upload-label-small:hover {
    border-color: var(--admin-primary);
    color: var(--admin-primary);
    background-color: rgba(59, 130, 246, 0.05);
}

.upload-label-small i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.upload-label-small span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Checkboxes mejorados */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 8px;
    background-color: var(--admin-surface);
    border: 1px solid var(--admin-border);
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.checkbox-label:hover {
    background-color: var(--admin-bg);
    border-color: var(--admin-primary);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--admin-border);
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background-color: var(--admin-primary);
    border-color: var(--admin-primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--admin-border);
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .form-container {
        padding: 1rem;
        margin: 0.5rem;
    }
    
    .form-grid,
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .image-upload-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .additional-images {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }
    
    .upload-label {
        width: 120px;
        height: 120px;
    }
    
    .upload-label-small {
        width: 80px;
        height: 80px;
    }
    
    .upload-label-small i {
        font-size: 1.2rem;
    }
    
    .upload-label-small span {
        font-size: 0.7rem;
    }
    
    .current-image {
        width: 120px;
        height: 120px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .checkbox-row {
        grid-template-columns: 1fr;
    }
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--admin-primary);
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: var(--admin-text-light);
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-danger {
    background-color: var(--admin-danger);
    color: white;
}

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

/* Table Styles */
.table-container {
    background-color: var(--admin-surface);
    border-radius: 12px;
    box-shadow: var(--admin-shadow);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table th {
    background-color: var(--admin-bg);
    font-weight: 600;
    color: var(--admin-text);
}

.table tbody tr:hover {
    background-color: var(--admin-bg);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.5rem;
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: fixed;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .actions-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }