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

body {
    font-family: 'Outfit', sans-serif;
    background-color: #f7f9fc;
    color: #334155;
    font-size: 16px;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Alertas */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 600;
}
.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Pantalla de Login */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}
.login-card {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-card h2 {
    color: #1e293b;
    margin-bottom: 8px;
    font-weight: 700;
}
.login-card p {
    color: #64748b;
    margin-bottom: 24px;
    font-size: 14px;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: #0f172a;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    flex-shrink: 0;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), padding 0.25s ease;
    position: relative;
}
.sidebar.collapsed {
    width: 72px;
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid #1e293b;
    min-height: 64px;
}
.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
}
.sidebar-brand-text h3 {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.5px;
    margin: 0;
}
.sidebar-brand-text span {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}
.sidebar-logo-icon {
    display: none;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border-radius: 8px;
    font-weight: 800;
    font-size: 14px;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    margin: 0 auto 10px auto;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.sidebar-toggle-btn {
    background: #1e293b;
    color: #94a3b8;
    border: 1px solid #334155;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.sidebar-toggle-btn:hover {
    color: #fff;
    background: #334155;
    border-color: #475569;
}
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px 12px;
}
.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #94a3b8;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-menu a .menu-icon {
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}
.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: #1e293b;
    color: #f8fafc;
}
.sidebar-menu a.active {
    border-left: 3px solid #2563eb;
    background: rgba(37, 99, 235, 0.12);
    color: #60a5fa;
}
.sidebar-menu .logout-link {
    margin-top: 30px;
    color: #fca5a5;
}
.sidebar-menu .logout-link:hover {
    background-color: #7f1d1d;
    color: #ffffff;
}

/* Collapsed State Overrides */
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-menu a span.menu-text {
    display: none !important;
}
.sidebar.collapsed .sidebar-header {
    padding: 16px 8px 12px 8px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.sidebar.collapsed .sidebar-logo-icon {
    display: flex;
}
.sidebar.collapsed .sidebar-toggle-btn {
    width: 100%;
    height: 26px;
    border-radius: 6px;
    font-size: 11px;
    background: #1e293b;
    color: #94a3b8;
}
.sidebar.collapsed .sidebar-toggle-btn:hover {
    background: #334155;
    color: #fff;
}
.sidebar.collapsed .sidebar-menu {
    padding: 16px 8px;
    gap: 6px;
}
.sidebar.collapsed .sidebar-menu a {
    padding: 10px 0;
    text-align: center;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: none;
}
.sidebar.collapsed .sidebar-menu a .menu-icon {
    font-size: 18px;
    margin: 0;
}
.sidebar.collapsed .sidebar-menu a:hover,
.sidebar.collapsed .sidebar-menu a.active {
    background-color: #1e293b;
}

/* Contenido Principal */
.main-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
.section-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-align: center;
}
.btn-primary {
    background-color: #2563eb;
    color: #ffffff;
}
.btn-primary:hover {
    background-color: #1d4ed8;
}
.btn-secondary {
    background-color: #e2e8f0;
    color: #475569;
}
.btn-secondary:hover {
    background-color: #cbd5e1;
}
.btn-danger {
    background-color: #ef4444;
    color: #ffffff;
}
.btn-danger:hover {
    background-color: #dc2626;
}
.btn-info {
    background-color: #0d9488;
    color: #ffffff;
}
.btn-info:hover {
    background-color: #0f766e;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}
.btn-block {
    display: block;
    width: 100%;
}

/* Formularios */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #334155;
    font-size: 14px;
}
.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    font-size: 15px;
    color: #334155;
    background-color: #ffffff;
    outline: none;
    transition: border-color 0.2s;
}
.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: #2563eb;
}
textarea {
    resize: vertical;
    min-height: 100px;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Tablas */
.table-container {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid #e2e8f0;
}
table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
th {
    background-color: #f8fafc;
    color: #64748b;
    font-weight: 600;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}
td {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}
tr:last-child td {
    border-bottom: none;
}
.table-img {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}
.no-img {
    width: 60px;
    height: 45px;
    background-color: #e2e8f0;
    color: #94a3b8;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-weight: 600;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}
.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Tendencias de Precios */
.trend-up {
    color: #10b981;
    font-weight: bold;
}
.trend-down {
    color: #ef4444;
    font-weight: bold;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}
.modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.close {
    position: absolute;
    right: 24px;
    top: 20px;
    font-size: 28px;
    font-weight: 700;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
}
.close:hover {
    color: #334155;
}

/* Configuración */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}
.settings-card {
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.settings-card h3 {
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
}

/* Newsletter CSS */
.newsletter-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 30px;
}
.newsletter-editor {
    background: white;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.newsletter-preview {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    padding: 20px;
    border-radius: 8px;
}
.newsletter-preview h4 {
    margin-bottom: 15px;
    color: #475569;
}
.email-mockup {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* Barra de progreso */
.progress-box {
    margin-top: 25px;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}
.progress-bar-container {
    background-color: #e2e8f0;
    border-radius: 9999px;
    height: 12px;
    overflow: hidden;
    margin-top: 10px;
}
.progress-bar {
    background-color: #3b82f6;
    height: 100%;
    transition: width 0.3s ease;
}

/* Adaptación Móvil */
@media (max-width: 1024px) {
    .dashboard-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        padding: 15px 0;
    }
    .sidebar-menu {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 10px;
    }
    .sidebar-menu .logout-link {
        margin-top: 0;
    }
    .form-grid, .settings-grid, .newsletter-grid {
        grid-template-columns: 1fr;
    }
}

/* Switch Toggle Slider */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
}
input:checked + .slider {
  background-color: #22c55e;
}
input:checked + .slider:before {
  transform: translateX(22px);
}
.slider.round {
  border-radius: 34px;
}
.slider.round:before {
  border-radius: 50%;
}

/* Search bar wrappers */
.search-filter-wrapper {
  margin-bottom: 20px;
}

/* Existing Image Cards */
.existing-img-card label {
  margin-bottom: 0 !important;
  font-size: 11px !important;
  color: #475569 !important;
}

/* Drag and Drop Sortable styles */
.sortable-row {
    transition: background-color 0.2s;
}
.sortable-row.sortable-ghost {
    opacity: 0.4;
    background-color: #e0f2fe !important;
    border: 2px dashed #0284c7;
}
.drag-handle {
    cursor: grab;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    padding: 4px;
    font-size: 18px;
    user-select: none;
}
.drag-handle:active {
    cursor: grabbing;
}
.drag-handle:hover {
    color: #475569;
}
.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #0f172a;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}
.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}
.toast-notification.success {
    border-left: 4px solid #22c55e;
}
.toast-notification.error {
    border-left: 4px solid #ef4444;
}

/* Loading Overlay & Button Spinner */
.form-preloader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #ffffff;
}
.form-preloader-overlay.active {
    display: flex;
}
.preloader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

