/* Variables Globales y Sistema de Diseño */
:root {
    --bg-main: #0B0F19;
    --bg-card: #151D30;
    --bg-card-hover: #1C263E;
    --bg-input: #1E293B;
    
    --primary: #F44336;
    --primary-hover: #D32F2F;
    --primary-rgb: 244, 67, 54;
    
    --success: #10B981;
    --success-rgb: 16, 185, 129;
    --danger: #EF4444;
    --danger-hover: #DC2626;
    
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --text-dark: #64748B;
    --border-color: #334155;
    --border-hover: #475569;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Elementos Utilitarios */
.hidden {
    display: none !important;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

/* Scrollbars Personalizadas */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-dark);
}

/* --- VISTA DE AUTENTICACIÓN --- */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(circle at top right, rgba(244, 67, 54, 0.08), transparent 40%),
                radial-gradient(circle at bottom left, rgba(21, 29, 48, 0.5), transparent 50%);
}

.auth-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.auth-card:hover {
    border-color: rgba(244, 67, 54, 0.3);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 0 40px rgba(244, 67, 54, 0.05);
}

.brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 24px;
}
.brand-viinder {
    color: var(--primary);
}
.brand-app {
    color: var(--text-muted);
}

h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 32px;
}

/* --- INPUTS Y FORMULARIOS --- */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

label .required {
    color: var(--danger);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"] {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
    width: 100%;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.15);
    background-color: rgba(30, 41, 59, 0.8);
}

input::placeholder {
    color: var(--text-dark);
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}
.col-half {
    flex: 1;
}
.flex-align-end {
    display: flex;
    align-items: flex-end;
    padding-bottom: 12px;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Checkbox Personalizado */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: var(--transition);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

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

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.2);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(244, 67, 54, 0.35);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
    background-color: var(--danger-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}

.btn-block {
    width: 100%;
}
.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

/* --- ALERTAS --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #FCA5A5;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #A7F3D0;
}

/* --- NAVEGACIÓN SUPERIOR --- */
.navbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-md);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 800;
}

.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.badge-admin {
    background-color: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: var(--primary);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-email {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* --- ESQUEMA DE DASHBOARD --- */
.dashboard-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dashboard-content {
    flex: 1;
    padding: 40px;
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 40px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .dashboard-content {
        grid-template-columns: 1fr;
    }
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.card-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

/* --- ZONA DRAG AND DROP --- */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 28px;
    text-align: center;
    background-color: rgba(11, 15, 25, 0.4);
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background-color: rgba(244, 67, 54, 0.02);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.drop-zone-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.drop-icon {
    color: var(--text-dark);
    transition: var(--transition);
}
.drop-zone:hover .drop-icon {
    color: var(--primary);
    transform: translateY(-2px);
}

.drop-text {
    font-size: 0.95rem;
    color: var(--text-muted);
}
.drop-text span {
    color: var(--primary);
    font-weight: 600;
}

.drop-info {
    font-size: 0.75rem;
    color: var(--text-dark);
}

/* Previsualización de Imagen */
.preview-container {
    position: relative;
    width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 3 / 1;
    z-index: 3;
    border: 1px solid var(--border-color);
}

.preview-container img {
    width: 100%;
    height: 100%;
    object-scale-down: cover;
    object-position: center;
    display: block;
}

.btn-remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.btn-remove-image:hover {
    background-color: var(--danger);
    color: white;
    transform: scale(1.05);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}
.form-actions .btn {
    flex: 1;
}

/* --- SECCIÓN LISTA DE BANNERS --- */
.list-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 24px;
}

.counter {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
}

.banners-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    max-height: 70vh;
    padding-right: 4px;
}

/* Diseño de Banner individual en Lista */
.banner-item {
    background-color: rgba(11, 15, 25, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    align-items: center;
    transition: var(--transition);
}

.banner-item:hover {
    border-color: var(--border-hover);
    background-color: rgba(11, 15, 25, 0.5);
    box-shadow: var(--shadow-md);
    transform: translateX(2px);
}

@media (max-width: 640px) {
    .banner-item {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.banner-img-wrapper {
    width: 100%;
    aspect-ratio: 3 / 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
    background-color: var(--bg-main);
}
.banner-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.banner-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.banner-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.banner-item-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.banner-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-all;
}
.banner-meta a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}
.banner-meta a:hover {
    text-decoration: underline;
}

.banner-info-tags {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.info-tag {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 4px;
    color: var(--text-muted);
}

.active-badge {
    background-color: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}
.inactive-badge {
    background-color: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.banner-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
    border-top: 1px solid rgba(51, 65, 85, 0.4);
    padding-top: 12px;
}

.btn-action {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
.btn-action-edit:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-action-delete:hover {
    border-color: var(--danger);
    color: var(--danger);
    background-color: rgba(239, 68, 68, 0.05);
}

.btn-action svg {
    width: 18px;
    height: 18px;
}

/* Mensaje de Lista Vacía */
.empty-list {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dark);
}
.empty-list svg {
    margin-bottom: 16px;
    stroke: var(--text-dark);
}
.empty-list p {
    font-size: 0.95rem;
    font-weight: 500;
}

/* --- MODAL --- */
.modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    animation: fadeIn 0.25s ease-out;
}

.modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95);
    animation: scaleUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: rgba(239, 68, 68, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.modal-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.modal-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 28px;
}
.modal-actions {
    display: flex;
    gap: 12px;
}
.modal-actions .btn {
    flex: 1;
}

/* --- ANIMACIONES Y EFECTOS --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleUp {
    to { transform: scale(1); }
}

/* Spinner de Carga */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Esqueleto de Carga (Skeletons) */
.skeleton-banner {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--radius-md);
    height: 120px;
    border: 1px solid var(--border-color);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
