/* ===== PANEL ADMINISTRATIVO - ESTILOS ESPECÍFICOS ===== */
/* Separado del CSS principal para mejor organización */

/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
}

/* ===== VARIABLES DE ADMIN ===== */
:root {
    --admin-primary: #2563eb;
    --admin-primary-hover: #1d4ed8;
    --admin-secondary: #64748b;
    --admin-success: #16a34a;
    --admin-warning: #f59e0b;
    --admin-danger: #dc2626;
    --admin-bg: #f8fafc;
    --admin-card-bg: #ffffff;
    --admin-border: #e2e8f0;
    --admin-text: #1e293b;
    --admin-text-secondary: #64748b;
    --admin-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --admin-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* ===== LAYOUT PRINCIPAL ===== */
.admin-body {
    background: var(--admin-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--admin-text);
    min-height: 100vh;
    width: 100%;
}

.admin-container {
    max-width: 100vw;
    width: 100%;
    margin: 0;
    padding: 12px;
    overflow-x: hidden;
}

/* ===== HEADER ADMINISTRATIVO ===== */
.admin-header {
    background: var(--admin-card-bg);
    border-bottom: 1px solid var(--admin-border);
    padding: 16px 0;
    margin-bottom: 24px;
    box-shadow: var(--admin-shadow);
}

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

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--admin-primary);
    font-weight: 600;
    font-size: 18px;
}

.admin-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-hover));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-user-name {
    font-weight: 500;
    color: var(--admin-text);
}

.admin-logout-btn {
    background: var(--admin-danger);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.admin-logout-btn:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

/* ===== SIDEBAR NAVEGACIÓN ===== */
.admin-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    min-height: calc(100vh - 200px);
    width: 100%;
}

.admin-sidebar {
    background: var(--admin-card-bg);
    border-radius: 12px;
    border: 1px solid var(--admin-border);
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
    box-shadow: var(--admin-shadow);
}

.admin-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-nav li {
    margin-bottom: 4px;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--admin-text-secondary);
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.admin-nav-link:hover {
    background: #f1f5f9;
    color: var(--admin-primary);
    transform: translateX(4px);
}

.admin-nav-link.active {
    background: var(--admin-primary);
    color: white;
}

.admin-nav-link i {
    width: 20px;
    text-align: center;
}

/* ===== CONTENIDO PRINCIPAL ===== */
.admin-main {
    background: var(--admin-card-bg);
    border-radius: 12px;
    border: 1px solid var(--admin-border);
    padding: 24px;
    box-shadow: var(--admin-shadow);
    width: 100%;
    overflow-x: hidden;
}

.admin-section {
    margin-bottom: 16px;
}

.admin-section:last-child {
    margin-bottom: 0;
}

.admin-section-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--admin-text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-section-title i {
    color: var(--admin-primary);
}

.admin-section-description {
    color: var(--admin-text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
    font-size: 14px;
}

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

.admin-stat-card {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--admin-shadow);
    transition: all 0.3s ease;
}

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

.admin-stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.admin-stat-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--admin-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.admin-stat-icon.products { background: var(--admin-primary); }
.admin-stat-icon.orders { background: var(--admin-success); }
.admin-stat-icon.clients { background: var(--admin-warning); }
.admin-stat-icon.revenue { background: #8b5cf6; }

.admin-stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--admin-text);
    margin-bottom: 4px;
}

.admin-stat-change {
    font-size: 14px;
    font-weight: 500;
}

.admin-stat-change.positive { color: var(--admin-success); }
.admin-stat-change.negative { color: var(--admin-danger); }

/* ===== FORMULARIOS ===== */
.admin-form {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--admin-shadow);
}

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

.admin-form-grid .span-2 {
    grid-column: span 2;
}

.admin-form-section {
    background: #f8fafc;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    margin-bottom: 24px;
}

.admin-form-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--admin-text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.admin-form-group:last-child {
    margin-bottom: 0;
}

.admin-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--admin-border);
}

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

.admin-form-label.required::after {
    content: "*";
    color: var(--admin-danger);
    margin-left: 4px;
}

.admin-form-input,
.admin-form-select,
.admin-form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--admin-text);
    background: white;
    transition: all 0.2s ease;
}

.admin-form-input:focus,
.admin-form-select:focus,
.admin-form-textarea:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

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

.admin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ===== BOTONES ADMINISTRATIVOS ===== */
.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.admin-btn:hover {
    transform: translateY(-1px);
}

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

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

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

.admin-btn.secondary:hover {
    background: #475569;
}

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

.admin-btn.success:hover {
    background: #15803d;
}

.admin-btn.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

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

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

.admin-btn.warning:hover {
    background: #d97706;
}

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

.admin-btn.danger:hover {
    background: #b91c1c;
}

.admin-btn.outline {
    background: transparent;
    border: 1px solid var(--admin-border);
    color: var(--admin-text);
}

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

.admin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.admin-btn-small {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.admin-btn-small:hover {
    transform: translateY(-1px);
}

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

.admin-btn-small.primary:hover {
    background: var(--admin-primary-hover);
}

.admin-btn-small.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

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

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

.admin-btn-small.danger:hover {
    background: #b91c1c;
}

/* ===== TABLA DE PRODUCTOS ===== */
.admin-table-container {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--admin-shadow);
}

.admin-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--admin-border);
    background: #f8fafc;
    flex-wrap: wrap;
}

.admin-table-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--admin-text);
    margin: 0;
}

.admin-table-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex-wrap: wrap;
}

/* ===== FILTROS DE BÚSQUEDA ===== */
.admin-filters {
    padding: 8px 0 12px 0;
    background: var(--admin-bg);
    border-bottom: 1px solid var(--admin-border);
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
}

.admin-filters-row {
    display: grid;
    grid-template-columns: 1.5fr 0.6fr 1fr 0.9fr 0.9fr auto;
    gap: 8px;
    align-items: end;
}

.admin-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-filter-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--admin-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-filter-label i {
    font-size: 11px;
    opacity: 0.7;
}

.admin-filter-input,
.admin-filter-select {
    padding: 7px 9px;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--admin-text);
    background: white;
    transition: all 0.2s ease;
    max-width: 220px;
}}

#filterCategory {
    max-width: 90px;
}

.admin-filter-input:focus,
.admin-filter-select:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.admin-filter-input::placeholder {
    color: var(--admin-text-secondary);
    opacity: 0.6;
}

.admin-filter-select {
    cursor: pointer;
}

.admin-filter-group .admin-btn {
    width: 100%;
    min-width: 100px;
}

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

.admin-table th {
    background: #f8fafc;
    padding: 10px 8px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--admin-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--admin-border);
    white-space: nowrap;
}

.admin-table td {
    padding: 6px 4px;
    border-bottom: 1px solid var(--admin-border);
    color: var(--admin-text);
    font-size: 13px;
    white-space: nowrap;
}

.admin-table td + td {
    border-left: 1px solid #eef2f7;
    padding-left: 6px;
}

.admin-table tr:hover {
    background: #f8fafc;
}

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

/* Ajustes específicos de columnas de productos */
#productsTable td:nth-child(3) {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== IMAGEN DE PRODUCTO ===== */
.admin-product-image,
.admin-table-image {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--admin-border);
    background: #f8fafc;
    transition: transform 0.2s ease;
}

.admin-table-image {
    display: block;
    cursor: pointer;
}

.admin-table-image:hover {
    transform: scale(2.5);
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.admin-product-sku {
    font-family: 'Courier New', monospace;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.admin-product-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.admin-product-status.active {
    background: #dcfce7;
    color: #166534;
}

.admin-product-status.inactive {
    background: #fef2f2;
    color: #991b1b;
}

/* ===== ACCIONES DE TABLA ===== */
.admin-table-actions-cell {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}

.admin-action-btn {
    padding: 4px 6px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-size: 12px;
    transition: all 0.2s ease;
}

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

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

.admin-action-btn:hover {
    transform: scale(1.05);
}

/* ===== UPLOAD DE IMAGEN ===== */
.admin-image-upload {
    border: 2px dashed var(--admin-border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.admin-image-upload:hover {
    border-color: var(--admin-primary);
    background: #f8fafc;
}

.admin-image-upload.dragover {
    border-color: var(--admin-primary);
    background: #eff6ff;
}

.admin-image-preview-container {
    margin-top: 16px;
    text-align: center;
}

.admin-image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    margin: 0 auto;
    display: block;
    border: 2px solid var(--admin-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.admin-btn-change-image {
    margin-top: 12px;
    padding: 8px 16px;
    background: #f3f4f6;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    color: var(--admin-text);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.admin-btn-change-image:hover {
    background: #e5e7eb;
    border-color: var(--admin-primary);
    color: var(--admin-primary);
}

.admin-btn-change-image i {
    margin-right: 6px;
}

/* ===== UPLOAD DE ARCHIVOS ===== */
.admin-file-upload {
    border: 2px dashed var(--admin-border);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #fafbfc;
}

.admin-file-upload:hover {
    border-color: var(--admin-success);
    background: #f0fdf4;
}

.admin-file-upload.dragover {
    border-color: var(--admin-success);
    background: #dcfce7;
    transform: scale(1.02);
}

/* ===== MODALES ===== */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow: hidden;
    padding: 20px;
}

.admin-modal.show {
    display: flex !important;
    opacity: 1;
    visibility: visible;
}

/* Bloquear scroll del body cuando modal está abierto */
body.admin-modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

.admin-modal-content {
    background: var(--admin-card-bg);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
}

.admin-modal.show .admin-modal-content {
    transform: scale(1);
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid var(--admin-border);
    flex-shrink: 0;
    background: var(--admin-card-bg);
    border-radius: 16px 16px 0 0;
}

.admin-modal-body {
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(37, 99, 235, 0.4) rgba(0, 0, 0, 0.05);
}

/* Estilos del scrollbar para Webkit (Chrome, Safari, Edge) */
.admin-modal-body::-webkit-scrollbar {
    width: 8px;
}

.admin-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.admin-modal-body::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.4);
    border-radius: 4px;
}

.admin-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.6);
}

.admin-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 2px solid var(--admin-border);
    flex-shrink: 0;
    background: var(--admin-card-bg);
    border-radius: 0 0 16px 16px;
}

.admin-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--admin-text);
}

.admin-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--admin-text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.admin-modal-close:hover {
    background: var(--admin-bg);
    color: var(--admin-text);
}

/* ===== DISCOUNT PREVIEW ===== */
.admin-discount-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #0ea5e9;
    border-radius: 12px;
    margin-top: 8px;
    font-weight: 600;
}

.admin-discount-preview .original-price {
    color: #64748b;
    text-decoration: line-through;
    font-size: 15px;
}

.admin-discount-preview .discount-arrow {
    color: #0ea5e9;
    font-size: 20px;
    font-weight: bold;
}

.admin-discount-preview .discounted-price {
    color: #0ea5e9;
    font-size: 16px;
}

.admin-form-hint {
    display: block;
    font-size: 12px;
    color: var(--admin-text-secondary);
    margin-top: 4px;
    font-style: italic;
}

/* ===== MENSAJES DE ESTADO ===== */
.admin-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-message.success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.admin-message.error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.admin-message.warning {
    background: #fefce8;
    color: #a16207;
    border-color: #fde047;
}

.admin-message.info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

/* ===== PAGINACIÓN ===== */
.admin-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.admin-pagination-btn {
    padding: 8px 12px;
    border: 1px solid var(--admin-border);
    background: var(--admin-card-bg);
    color: var(--admin-text);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-pagination-btn:hover:not(:disabled) {
    border-color: var(--admin-primary);
    color: var(--admin-primary);
}

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

.admin-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
    
    .admin-sidebar {
        position: static;
    }
    
    .admin-form-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-stats {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .admin-container {
        padding: 16px;
    }
    
    .admin-main {
        padding: 16px;
    }
    
    .admin-table-container {
        overflow-x: auto;
    }
    
    .admin-table {
        min-width: 800px;
        font-size: 12px;
    }
    
    /* Ocultar columnas menos críticas en móvil */
    .admin-table th:nth-child(4),
    .admin-table td:nth-child(4),
    .admin-table th:nth-child(5),
    .admin-table td:nth-child(5) {
        display: none;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 6px 4px;
    }
    
    .admin-table-image {
        width: 32px;
        height: 32px;
    }
    
    .admin-modal-content {
        width: 95%;
        padding: 16px;
    }
}

/* ===== LOADING STATES ===== */
.admin-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.admin-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--admin-border);
    border-top: 2px solid var(--admin-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== OPTIMIZACIÓN MÓVIL ===== */
@media (max-width: 1024px) {
    .admin-container {
        padding: 0 16px;
    }

    .admin-layout {
        gap: 16px;
    }

    .admin-sidebar {
        width: 200px;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-header {
        padding: 12px 0;
        position: sticky;
        top: 0;
        z-index: 1000;
        background: var(--admin-card-bg);
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    .admin-container {
        padding: 12px;
    }

    .admin-brand {
        font-size: 16px;
    }

    .brand-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .admin-user-info {
        gap: 8px;
    }

    .admin-logout-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .admin-layout {
        display: flex;
        flex-direction: column;
        gap: 0;
        grid-template-columns: none;
    }

    .admin-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        padding: 0;
        border-right: none;
        border-top: 2px solid var(--admin-border);
        z-index: 9999;
        background: var(--admin-card-bg);
        box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
        border-radius: 0;
        top: auto;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .admin-nav {
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
        margin: 0;
        background: var(--admin-card-bg);
    }

    .admin-nav li {
        flex: 1;
        margin: 0;
    }

    .admin-nav-link {
        padding: 8px 4px;
        font-size: 10px;
        flex-direction: column;
        gap: 4px;
        border-left: none;
        border-bottom: 3px solid transparent;
        text-align: center;
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
    }

    .admin-nav-link i {
        font-size: 20px;
        margin-right: 0;
    }

    .admin-nav-link.active {
        border-left: none;
        border-bottom-color: var(--admin-primary);
        background: rgba(37, 99, 235, 0.1);
    }

    .admin-main {
        padding: 16px 12px 90px 12px;
        width: 100%;
    }

    .admin-card {
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 12px;
    }

    .admin-card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .admin-card-title {
        font-size: 20px;
        margin-bottom: 8px;
    }

    /* Filtros en móvil */
    .admin-filters {
        padding: 16px 12px;
    }

    .admin-filters-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .admin-filter-group {
        width: 100%;
    }

    .admin-filter-input,
    .admin-filter-select {
        width: 100%;
        font-size: 16px;
        padding: 12px;
    }

    .admin-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        border-radius: 8px;
    }

    .admin-table-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        padding: 16px;
        min-width: 100%;
    }

    .admin-table-title {
        font-size: 18px;
        width: 100%;
    }

    .admin-table-actions {
        width: 100%;
        flex-direction: column;
        gap: 8px;
        margin-left: 0;
    }

    .admin-table-actions .admin-btn {
        width: 100%;
        justify-content: center;
    }

    .admin-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .admin-table {
        min-width: 800px;
        font-size: 13px;
        width: 100%;
    }

    .admin-table th,
    .admin-table td {
        padding: 12px 10px;
        font-size: 13px;
        white-space: nowrap;
    }

    .admin-table-image {
        width: 50px;
        height: 50px;
    }

    .admin-table-actions-cell {
        white-space: nowrap;
    }

    .admin-btn-table {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Indicador visual de scroll */
    .admin-table-wrapper::after {
        content: '← Desliza →';
        position: sticky;
        right: 0;
        bottom: 0;
        background: linear-gradient(90deg, transparent, var(--admin-card-bg) 20%);
        padding: 8px 16px;
        font-size: 11px;
        color: var(--admin-text-secondary);
        text-align: right;
        pointer-events: none;
    }

    .admin-modal {
        padding: 0;
        align-items: flex-end;
        justify-content: center;
    }

    .admin-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        padding: 20px 16px;
        margin: 0;
        border-radius: 20px 20px 0 0;
        animation: slideUp 0.3s ease;
        transform: none;
    }

    .admin-modal.show .admin-modal-content {
        transform: none;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    .admin-modal-header {
        position: sticky;
        top: 0;
        background: var(--admin-card-bg);
        z-index: 10;
        margin: -20px -16px 16px -16px;
        padding: 16px;
        border-bottom: 2px solid var(--admin-border);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .admin-modal-close {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .admin-form-section {
        padding: 16px;
        background: var(--admin-bg);
        border-radius: 8px;
    }

    .admin-form-section-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .admin-form-group {
        margin-bottom: 16px;
    }

    .admin-form-label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .admin-form-input,
    .admin-form-select,
    .admin-form-textarea {
        padding: 14px 12px;
        font-size: 16px;
        border-radius: 10px;
        -webkit-appearance: none;
        appearance: none;
    }

    /* Evitar zoom en iOS */
    .admin-form-input:focus,
    .admin-form-select:focus,
    .admin-form-textarea:focus {
        font-size: 16px;
    }

    .admin-image-upload {
        padding: 30px 16px;
    }

    .admin-image-preview {
        max-height: 250px;
        border-radius: 8px;
    }

    .admin-btn-change-image {
        width: 100%;
        padding: 12px 16px;
        font-size: 15px;
    }

    .admin-modal-footer {
        position: sticky;
        bottom: 0;
        background: var(--admin-card-bg);
        margin: 16px -16px -20px -16px;
        padding: 16px;
        border-top: 1px solid var(--admin-border);
        flex-direction: column-reverse;
        gap: 10px;
    }

    .admin-modal-footer .admin-btn {
        width: 100%;
        padding: 14px;
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 28px;
    }

    .stat-label {
        font-size: 13px;
    }

    .admin-btn {
        padding: 12px 20px;
        font-size: 15px;
        border-radius: 8px;
    }

    .admin-btn i {
        font-size: 16px;
    }

    .admin-pagination-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    /* Modal responsive para tablets */
    .admin-modal {
        padding: 16px;
    }
    
    .admin-modal-content {
        width: 95%;
        max-height: calc(100vh - 32px);
    }
    
    .admin-modal-header,
    .admin-modal-footer {
        padding: 16px 20px;
    }
    
    .admin-modal-body {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .admin-container {
        padding: 0 12px;
    }

    .admin-brand span {
        font-size: 16px;
    }

    .admin-user-name {
        display: none;
    }

    .admin-logout-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .admin-logout-btn span {
        display: none;
    }

    .admin-nav-link {
        font-size: 9px;
        padding: 8px 2px;
    }

    .admin-nav-link i {
        font-size: 18px;
    }

    .admin-main {
        padding: 12px 8px 80px 8px;
    }

    .admin-card {
        padding: 12px;
        border-radius: 8px;
    }

    .admin-card-title {
        font-size: 18px;
    }

    .admin-table {
        min-width: 800px;
        font-size: 12px;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 6px;
        font-size: 12px;
    }

    .admin-table-image {
        width: 40px;
        height: 40px;
    }

    .admin-btn-table {
        padding: 5px 8px;
        font-size: 11px;
    }

    .admin-modal-content {
        width: 96%;
        max-height: calc(100vh - 24px);
    }
    
    .admin-modal-header,
    .admin-modal-footer {
        padding: 14px 16px;
    }

    .admin-modal-title {
        font-size: 18px;
    }
    
    .admin-modal-body {
        padding: 16px;
    }
}

    .admin-form-section {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .notification-container {
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 100px;
    }

    .admin-table-wrapper {
        margin: -12px;
        padding: 12px;
    }
}

@media (max-width: 360px) {
    .admin-brand {
        font-size: 14px;
    }

    .brand-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .admin-nav-link {
        font-size: 8px;
        padding: 6px 1px;
    }

    .admin-nav-link i {
        font-size: 16px;
    }

    .admin-card-title {
        font-size: 16px;
    }
    
    .admin-modal {
        padding: 12px;
    }
    
    .admin-modal-content {
        width: 98%;
        max-height: calc(100vh - 24px);
    }
    
    .admin-modal-header,
    .admin-modal-footer {
        padding: 12px 14px;
    }
    
    .admin-modal-body {
        padding: 14px;
    }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .admin-btn,
    .admin-nav-link,
    .admin-table-actions button,
    .admin-pagination-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .admin-form-input,
    .admin-form-select,
    .admin-form-textarea {
        font-size: 16px;
        padding: 14px;
    }

    .admin-table-actions-cell button {
        margin: 4px 2px;
    }
}

    /* Mejor scrolling en iOS */
    .admin-table-wrapper,
    .admin-modal-content {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    /* Evitar zoom accidental */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Landscape mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .admin-modal-content {
        max-height: 85vh;
    }

    .admin-main {
        padding-bottom: 70px;
    }
}

/* Mejoras de accesibilidad y UX */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Smooth scrolling global */
html {
    scroll-behavior: smooth;
}

/* Mejora de contraste en dispositivos de alto contraste */
@media (prefers-contrast: high) {
    .admin-btn {
        border-width: 2px;
    }

    .admin-form-input,
    .admin-form-select,
    .admin-form-textarea {
        border-width: 2px;
    }
}

/* Optimización para pantallas táctiles grandes (tablets) */
@media (min-width: 768px) and (max-width: 1024px) and (hover: none) {
    .admin-modal-content {
        max-width: 700px;
        width: 85%;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .admin-table {
        font-size: 14px;
    }

    .admin-btn {
        min-height: 48px;
        padding: 12px 20px;
    }
}
/* ===== PLANTILLAS DE EMAIL ===== */
.email-templates-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 24px;
    min-height: 500px;
}

.templates-sidebar {
    border-right: 1px solid var(--admin-border);
    padding-right: 24px;
}

.templates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--admin-text);
    background: transparent;
    border: 1px solid transparent;
}

.template-item i {
    color: var(--admin-primary);
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.template-item:hover {
    background: #f1f5f9;
}

.template-item.active {
    background: #eff6ff;
    border-color: var(--admin-primary);
    color: var(--admin-primary);
    font-weight: 500;
}

.template-editor {
    padding-left: 24px;
}

.template-header {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--admin-border);
}

/* Estilos para editor visual de emails */
.email-format-btn {
    padding: 6px 10px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    color: #4b5563;
    font-size: 14px;
    transition: all 0.2s;
}

.email-format-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #1f2937;
}

.email-format-btn:active {
    background: #e5e7eb;
}

.email-format-select {
    padding: 6px 10px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    color: #4b5563;
    font-size: 13px;
}

.email-variable-btn {
    padding: 4px 10px;
    background: white;
    border: 1px solid #0ea5e9;
    border-radius: 4px;
    cursor: pointer;
    color: #0369a1;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.email-variable-btn:hover {
    background: #0ea5e9;
    color: white;
}

.email-variable-btn i {
    font-size: 11px;
}

.email-visual-editor:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.email-visual-editor h1 {
    font-size: 28px;
    font-weight: bold;
    margin: 16px 0 12px 0;
    color: #111827;
}

.email-visual-editor h2 {
    font-size: 22px;
    font-weight: bold;
    margin: 14px 0 10px 0;
    color: #1f2937;
}

.email-visual-editor h3 {
    font-size: 18px;
    font-weight: bold;
    margin: 12px 0 8px 0;
    color: #374151;
}

.email-visual-editor p {
    margin: 8px 0;
}

.email-visual-editor ul,
.email-visual-editor ol {
    margin: 8px 0;
    padding-left: 24px;
}

.email-visual-editor li {
    margin: 4px 0;
}

@media (max-width: 768px) {
    .email-templates-container {
        grid-template-columns: 1fr;
    }
    .templates-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--admin-border);
        padding-right: 0;
        padding-bottom: 16px;
    }
    .templates-list {
        flex-direction: row;
        overflow-x: auto;
    }
    .template-item {
        flex: 0 0 auto;
        min-width: 140px;
    }
    .template-editor {
        padding-left: 0;
    }
}

/* Email Settings Styles */
.admin-emails-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.admin-email-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    transition: all 0.2s;
}

.admin-email-item:hover {
    border-color: var(--admin-primary);
    background: rgba(37, 99, 235, 0.05);
}

.admin-email-text {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--admin-text);
    font-weight: 500;
}

.admin-email-text i {
    color: var(--admin-primary);
}

.admin-email-remove {
    padding: 6px 12px;
    background: var(--admin-danger);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.admin-email-remove:hover {
    background: #b91c1c;
    transform: scale(1.05);
}

.admin-emails-list:empty::before {
    content: "No hay correos configurados";
    display: block;
    padding: 20px;
    text-align: center;
    color: var(--admin-text-secondary);
    font-style: italic;
}

/* ===== ZONA DE CARGA DE ARCHIVOS ===== */
.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-zone:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.upload-zone:active {
    transform: scale(0.98);
}
