/* ==========================================================================
   LEGIÓN MERCEDINA - PANEL DE ADMINISTRACIÓN (CSS)
   Paleta: Rojo, Negro y Blanco | Menú Lateral Izquierdo + Crear Eventos
   ========================================================================== */

:root {
    --red-primary: #E10600;
    --red-bright: #FF2424;
    --red-dark: #A50000;
    --black-bg: #0B0B0F;
    --black-sidebar: #111117;
    --black-card: #171720;
    --black-input: #0F0F15;
    --black-border: #282836;
    --white: #FFFFFF;
    --gray-light: #DFDFE8;
    --gray-muted: #9898AA;
    --success: #22C55E;
    --danger: #EF4444;
    --font-heading: 'Oswald', sans-serif;
    --font-body: 'Montserrat', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--black-bg);
    color: var(--white);
    line-height: 1.5;
}

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

/* ==========================================================================
   PANTALLA DE LOGIN ADMIN
   ========================================================================== */
.admin-login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at top right, rgba(225, 6, 0, 0.2), transparent 45%),
                var(--black-bg);
}

.login-wrapper {
    width: 100%;
    max-width: 430px;
}

.login-card {
    background: var(--black-card);
    border: 1px solid var(--black-border);
    border-top: 4px solid var(--red-primary);
    border-radius: 16px;
    padding: 38px 32px;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.65);
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-badge {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 14px;
    box-shadow: 0 8px 20px rgba(225, 6, 0, 0.35);
}

.login-brand h1 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    letter-spacing: 1px;
}

.login-brand h1 span {
    color: var(--red-primary);
}

.login-brand p {
    color: var(--gray-muted);
    font-size: 0.88rem;
    margin-top: 4px;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    padding-top: 18px;
    border-top: 1px solid var(--black-border);
}

.back-site-link {
    font-size: 0.86rem;
    color: var(--gray-muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}

.back-site-link:hover {
    color: var(--red-primary);
}

/* ==========================================================================
   LAYOUT PRINCIPAL DEL DASHBOARD (MENÚ LATERAL IZQUIERDO)
   ========================================================================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 280px;
    background: var(--black-sidebar);
    border-right: 1px solid var(--black-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--black-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--red-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--white);
    flex-shrink: 0;
}

.sidebar-logo h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    letter-spacing: 0.8px;
    line-height: 1.1;
}

.sidebar-logo span {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--red-primary);
    letter-spacing: 1.5px;
}

.sidebar-menu-label {
    padding: 22px 20px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: var(--gray-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 12px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-light);
    transition: 0.22s ease;
}

.sidebar-link i {
    width: 20px;
    font-size: 1.05rem;
    color: var(--gray-muted);
    transition: 0.22s ease;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.sidebar-link.active {
    background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
    color: var(--white);
    box-shadow: 0 6px 18px rgba(225, 6, 0, 0.35);
}

.sidebar-link.active i {
    color: var(--white);
}

.sidebar-counter {
    margin-left: auto;
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 9px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
}

.logout-link:hover i {
    color: var(--danger);
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px 20px;
    border-top: 1px solid var(--black-border);
    font-size: 0.78rem;
    color: var(--gray-muted);
}

.sidebar-footer strong {
    color: var(--success);
}

.sidebar-footer small {
    display: block;
    margin-top: 4px;
    opacity: 0.8;
}

/* ==========================================================================
   ÁREA PRINCIPAL DEL ADMIN
   ========================================================================== */
.admin-main {
    flex-grow: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    background: var(--black-sidebar);
    border-bottom: 1px solid var(--black-border);
    padding: 20px 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-left h1 {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.topbar-left p {
    font-size: 0.84rem;
    color: var(--gray-muted);
}

.sidebar-mobile-toggle {
    display: none;
    background: var(--black-card);
    border: 1px solid var(--black-border);
    color: var(--white);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
}

.admin-content-wrap {
    padding: 32px 34px;
    max-width: 1120px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* ==========================================================================
   TARJETAS Y FORMULARIO "CREAR EVENTOS"
   ========================================================================== */
.admin-panel-card {
    background: var(--black-card);
    border: 1px solid var(--black-border);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

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

.panel-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--red-primary);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.panel-card-header h2 {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    text-transform: uppercase;
    margin-top: 3px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gray-light);
}

.req {
    color: var(--red-primary);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 13px 15px;
    background: var(--black-input);
    border: 1px solid var(--black-border);
    border-radius: 10px;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.92rem;
    transition: 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--red-primary);
    box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.2);
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--red-primary);
}

.input-icon-wrap input {
    padding-left: 42px !important;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--gray-muted);
}

/* Subida y Previsualización de Foto de Evento */
.photo-upload-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--black-border);
    border-radius: 12px;
    padding: 20px;
}

.photo-inputs-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 22px;
    align-items: stretch;
}

.file-drop-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 22px;
    border: 2px dashed rgba(225, 6, 0, 0.45);
    border-radius: 10px;
    background: rgba(225, 6, 0, 0.05);
    cursor: pointer;
    text-align: center;
    transition: 0.2s;
}

.file-drop-area:hover {
    background: rgba(225, 6, 0, 0.12);
    border-color: var(--red-primary);
}

.file-drop-area i {
    font-size: 1.8rem;
    color: var(--red-primary);
}

.file-drop-area span {
    font-size: 0.84rem;
    color: var(--gray-light);
}

.file-drop-area input[type="file"] {
    display: none;
}

.photo-url-fallback {
    margin-top: 14px;
}

.photo-preview-frame {
    height: 100%;
    min-height: 165px;
    background: var(--black-input);
    border: 1px solid var(--black-border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-preview-frame img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.photo-preview-placeholder {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--gray-muted);
    font-size: 0.8rem;
}

.photo-preview-placeholder i {
    font-size: 2rem;
    opacity: 0.6;
}

/* Botones Admin */
.btn-admin-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
    color: var(--white);
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(225, 6, 0, 0.35);
    transition: 0.22s;
}

.btn-admin-primary:hover {
    background: linear-gradient(135deg, var(--red-bright), var(--red-primary));
    transform: translateY(-2px);
}

.btn-full {
    width: 100%;
}

.btn-admin-outline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--black-border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-light);
    transition: 0.2s;
}

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

/* Alertas */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.45);
    color: #86efac;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fca5a5;
}

/* Tabla de Eventos */
.admin-events-table-wrap {
    overflow-x: auto;
}

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

.admin-table th {
    padding: 14px 16px;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-muted);
    border-bottom: 1px solid var(--black-border);
}

.admin-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.88rem;
    vertical-align: middle;
}

.table-thumb {
    width: 72px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--black-border);
}

.table-title {
    display: block;
    color: var(--white);
    font-size: 0.95rem;
}

.table-subtitle {
    display: block;
    font-size: 0.78rem;
    color: var(--gray-muted);
}

.table-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(225, 6, 0, 0.14);
    color: #ff8080;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.82rem;
    white-space: nowrap;
}

.table-link-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--red-primary);
    font-weight: 600;
}

.table-link-pill:hover {
    text-decoration: underline;
}

.text-muted {
    color: var(--gray-muted);
    font-size: 0.8rem;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-action {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--black-border);
    transition: 0.2s;
}

.btn-action.edit:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.btn-action.delete:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
    color: #fca5a5;
}

.empty-admin-events {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-muted);
}

.empty-admin-events i {
    font-size: 2.2rem;
    color: var(--red-primary);
    margin-bottom: 10px;
}

/* Ediciones Anteriores Admin */
.webp-badge-note {
    display: inline-block;
    margin-top: 4px;
    background: rgba(225, 6, 0, 0.18);
    color: #ff9999;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 50px;
}

.upload-status-note {
    margin-top: 10px;
    font-size: 0.82rem;
    color: #86efac;
}

.multi-photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.multi-preview-item {
    position: relative;
    height: 68px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--red-primary);
}

.multi-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.multi-preview-item span {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(225, 6, 0, 0.85);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    text-align: center;
    padding: 2px 0;
}

.ediciones-admin-list-wrap {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--black-border);
}

.sub-table-heading {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    color: var(--white);
}

@media (max-width: 900px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .form-grid-2,
    .photo-inputs-grid {
        grid-template-columns: 1fr;
    }

    .admin-content-wrap {
        padding: 20px;
    }
}
