/* ======== VARIABLES BASE ======== */
:root {
    --primary: #8B5E3C;        /* Café cálido retro */
    --primary-dark: #593825;   /* Café oscuro */
    --primary-light: #B08D6B;  /* Café claro */

    --accent: #C25454;         /* Rojo retro suave */
    --accent-dark: #A14343;    /* Rojo oscuro */
    --accent-soft: #ECDCC7;    /* Crema papel antiguo */

    --vibrant-1: #B44242;      /* Rojo quemado vibrante */
    --vibrant-2: #8B5E3C;      /* Café rojizo */
    --vibrant-3: #A28B5C;      /* Beige oliva retro */

    --bg-light: #F4EDE3;       /* Crema suave */
    --bg-light-alt: #E8D9C8;   /* Crema cálido */
    --bg-dark: #E8D9C8;
    
    --text-dark: #2B1E14;      /* Café chocolate oscuro */
    --text-muted: #6A574B;     /* Café grisáceo suave */
    --text-light: #8A7866;     /* Café medio */

    --card-bg: #F8F3EB;        /* Crema muy claro */
    --white: #FFFFFF;
    --black: #1C1715;          /* Negro vintage suave */

    --shadow: 0 4px 12px rgba(75, 45, 20, 0.12);
    --shadow-hover: 0 8px 24px rgba(75, 45, 20, 0.18);
    --shadow-large: 0 12px 36px rgba(75, 45, 20, 0.15);

    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    display: flex;
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    height: 100vh;
    padding: 30px 20px;
    color: var(--white);
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow);
    position: fixed;
    z-index: 100;
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 10px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-icon {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(102, 71, 10, 0.945));
}

.menu-section {
    margin-bottom: 20px;
}

.menu-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    color: var(--accent-soft);
    opacity: 0.8;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
    margin-bottom: 5px;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.menu-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.bottom-section {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 20px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 30px;
    margin-left: 280px;
    width: calc(100% - 280px);
    min-height: 100vh;
}

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

.header-title h1 {
    font-size: 28px;
    color: var(--primary-dark);
    margin-bottom: 5px;
}

.header-title p {
    color: var(--text-muted);
    font-size: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--bg-light-alt) 100%);
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(139, 94, 60, 0.1);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.user-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(139, 94, 60, 0.3);
    border: 3px solid var(--accent-soft);
    transition: var(--transition);
}

.user-info:hover .user-avatar {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(139, 94, 60, 0.4);
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-name {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 16px;
    letter-spacing: 0.5px;
}

.user-role {
    font-size: 13px;
    color: var(--primary);
    background: rgba(139, 94, 60, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    display: inline-block;
    width: fit-content;
}
.user-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ===== ESTADÍSTICAS ===== */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

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

.stat-icon.sales {
    background: rgba(139, 94, 60, 0.2);
    color: var(--primary);
}

.stat-icon.products {
    background: rgba(139, 94, 60, 0.2);
    color: var(--primary);
}

.stat-icon.customers {
    background: rgba(139, 94, 60, 0.2);
    color: var(--primary);
}

.stat-icon.orders {
    background: rgba(139, 94, 60, 0.2);
    color: var(--primary);
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 14px;
}

/* ===== GRÁFICAS ===== */
.dashboard-section {
    margin-bottom: 40px;
}

.dashboard-section h2 {
    color: var(--primary-dark);
    margin-bottom: 20px;
    font-size: 22px;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    height: 400px;
}

.chart-box {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.chart-box:hover {
    box-shadow: var(--shadow-hover);
}

.chart-box h3 {
    color: var(--primary-dark);
    margin-bottom: 20px;
    font-size: 18px;
}

.chart-placeholder {
    flex: 1;
    background: var(--bg-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-style: italic;
}

/* ===== CONTENEDOR GENERAL DE FORMULARIOS ===== */
.crud-container {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-top: 20px;
}

.crud-container h2 {
    color: var(--primary-dark);
    margin-bottom: 25px;
    font-size: 24px;
    border-bottom: 2px solid var(--accent-soft);
    padding-bottom: 10px;
}

/* ===== FORMULARIOS ===== */
.crud-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.form-row input,
.form-row textarea,
.form-row select {
    padding: 12px 15px;
    border-radius: 10px;
    border: 1px solid var(--primary-light);
    background: var(--bg-light);
    color: var(--text-dark);
    transition: var(--transition);
    font-size: 15px;
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.25);
    outline: none;
}

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

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.form-actions .btn {
    flex: 1;
}

/* ===== SUBIDA DE IMÁGENES ===== */
.hidden-input {
    display: none;
}

/* Caja donde se sube la imagen */
.image-upload-box {
    width: 100%;
    padding: 25px;
    border: 2px dashed var(--primary);
    background: var(--bg-light);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s ease;
}

.image-upload-box:hover {
    background: var(--bg-dark);
    border-color: var(--primary-light);
}

.upload-icon {
    font-size: 40px;
    color: var(--primary);
    margin-bottom: 10px;
}

.image-preview {
    width: 120px;
    height: 120px;
    object-fit: cover;
    margin-top: 15px;
    border-radius: 10px;
    border: 2px solid var(--primary-light);
}

.hidden {
    display: none;
}


/* === Para la vista de eliminar === */
.delete-warning {
    background: rgba(194, 84, 84, 0.15);
    padding: 15px 20px;
    border-left: 5px solid var(--accent);
    border-radius: 10px;
    color: var(--accent-dark);
    margin-bottom: 25px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === Búsqueda === */
.search-section {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.search-input {
    flex: 1;
    padding: 12px 15px;
    border-radius: 10px;
    border: 1px solid var(--primary-light);
    background: var(--bg-light);
    color: var(--text-dark);
    font-size: 15px;
}

/* === Placeholders para datos === */
.data-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.data-placeholder i {
    font-size: 48px;
    margin-bottom: 15px;
    color: var(--primary-light);
}

/* ===== BOTONES ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--vibrant-3);
    color: white;
}

.btn-secondary:hover {
    background: #8f7a4a;
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
}

/* ===== NAVEGACIÓN Y ESTADOS ===== */
.page-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page-section.active {
    display: block;
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}


/* ===== NOTIFICACIONES ===== */
.notification button {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;

    /* forma redonda */
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    transition: var(--transition);
}

.notification button:hover {
    background: var(--accent-soft);
    color: var(--accent-dark);
    transform: scale(1.1);
    box-shadow: 0px 2px 6px rgba(0,0,0,0.15);
}

.notification {
    gap: 12px !important;
}

/* ========== TABLA DE CLIENTES ========== */
.table-wrapper {
    overflow-x: auto;
    background: var(--bg-light);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.clients-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.clients-table thead {
    background: var(--primary);
    color: white;
}

.clients-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clients-table tbody tr {
    border-bottom: 1px solid var(--bg-muted);
    transition: background 0.2s ease;
}

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

.clients-table td {
    padding: 15px;
    font-size: 14px;
    color: var(--text);
}

/* Avatar y nombre del cliente */
.client-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.client-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--vibrant-1));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

/* Status badges */
.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: rgba(var(--success-rgb), 0.1);
    color: var(--primary);
}

.status-badge.inactive {
    background: rgba(var(--error-rgb), 0.1);
    color: var(--accent);
}

/* Botones de acción */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-view {
    background: var(--primary-light);
    color: var(--primary);
}

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

.btn-edit {
    background: var(--vibrant-3-light);
    color: var(--vibrant-3);
}

.btn-edit:hover {
    background: var(--vibrant-3);
    color: white;
}

.btn-delete {
    background: rgba(var(--error-rgb), 0.1);
    color: var(--accent);
}

.btn-delete:hover {
    background: var(--accent);
    color: white;
}

/* Footer de la tabla */
.table-footer {
    padding: 15px;
    background: var(--bg-light);
    border-top: 1px solid var(--bg-muted);
    border-radius: 0 0 10px 10px;
    text-align: right;
    color: var(--text-muted);
}

.table-footer strong {
    color: var(--primary);
}

/* Loading y mensajes */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading i {
    font-size: 32px;
    color: var(--primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    text-align: center;
    padding: 40px;
    background: var(--bg-light);
    border-radius: 10px;
}

.error-message i {
    font-size: 48px;
    color: var(--accent);
    margin-bottom: 15px;
}

.error-message p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .clients-table th,
    .clients-table td {
        padding: 10px;
        font-size: 12px;
    }
    
    .client-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .btn-icon {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
}

/* Estilos para la sección de eliminar productos */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.product-delete-card {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-delete-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.product-image {
    width: 100%;
    height: 200px;
    background: var(--bg-dark);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.product-image i {
    font-size: 48px;
    color: var(--text-muted);
}

.product-details {
    flex: 1;
}

.product-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.product-category {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
}

.product-stock {
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-danger {
    background: var(--accent);
    width: 100%;
}

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

/* ===== ESTILOS PARA BÚSQUEDA Y ACTUALIZACIÓN ===== */

.search-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-results {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.search-results h3 {
    margin-bottom: 15px;
    color: var(--text);
    font-size: 18px;
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-search-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.product-search-item:hover {
    border-color: var(--primary);
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.product-image-small {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.product-image-small i {
    font-size: 24px;
    color: var(--text-muted);
}

.product-info {
    flex: 1;
}

.product-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: var(--text);
}

.product-category {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
}

.product-price {
    color: var(--primary);
    font-weight: 600;
    font-size: 16px;
    margin: 5px 0 0 0;
}

.product-search-item > i {
    color: var(--text-muted);
    font-size: 18px;
}

.update-form-container {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 25px;
    margin-top: 20px;
}

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

.form-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 20px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.hidden-input {
    display: none;
}

.image-upload-box {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    position: relative;
}

.image-upload-box:hover {
    border-color: var(--primary);
    background: var(--bg-light);
}

.upload-icon {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
}

.image-upload-box p {
    color: var(--text-muted);
    margin: 0;
}

.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.image-preview.hidden {
    display: none;
}

/* Responsivo */
@media (max-width: 768px) {
    .search-section {
        flex-direction: column;
    }
    
    .product-search-item {
        flex-direction: column;
        text-align: center;
    }
    
    .product-image-small {
        width: 80px;
        height: 80px;
    }
}