/* Estilos específicos para el Panel Administrativo */

.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

/* Sidebar */
.admin-sidebar {
    width: 280px;
    background: var(--elev);
    border-right: 1px solid var(--stroke);
    padding: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-nav {
    padding: 1.5rem 0;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    margin: 0 0.5rem 0.2rem 0.5rem;
    transition: all 0.2s ease;
    position: relative;
}

.admin-nav-item:hover,
.admin-nav-item.active {
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    color: white;
    transform: translateX(4px);
}

.admin-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--brand-light);
    border-radius: 0 4px 4px 0;
}

.admin-nav-item .material-icons {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* Contenido principal */
.admin-main {
    flex: 1;
    padding: 1.5rem;
    background: var(--bg);
}

/* Header administrativo */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--stroke);
    background: var(--elev);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.admin-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 0;
}

.admin-title .material-icons {
    color: var(--brand);
    font-size: 1.6rem;
}

.admin-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

/* Estilos de formularios administrativos */
.admin-form {
    background: var(--elev);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--stroke);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

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

@media (max-width: 1024px) {
    .form-row,
    .form-row.thirds {
        grid-template-columns: 1fr;
    }
}

.form-help {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.3rem;
}

.form-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* Inputs con iconos */
.input-with-icon {
    position: relative;
}

.input-with-icon .material-icons {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.input-with-icon input {
    padding-left: 2.5rem;
}

/* Select personalizado */
.custom-select {
    position: relative;
    display: inline-block;
    width: 100%;
}

.custom-select select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239aa3b2' d='M6 8L2 4h8l-4 4z'/%3E%3C/svg%3E") no-repeat right 0.8rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}

/* Checkboxes y radios personalizados */
.checkbox-group,
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.checkbox-item,
.radio-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.checkbox-item:hover,
.radio-item:hover {
    background: color-mix(in srgb, var(--brand) 5%, transparent);
}

.checkbox-item input,
.radio-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

.checkbox-item label,
.radio-item label {
    margin: 0;
    cursor: pointer;
    color: var(--text);
}

/* Estilos de tabla administrativa */
.admin-table {
    width: 100%;
    background: var(--elev);
    border: 1px solid var(--stroke);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--stroke);
}

.admin-table th {
    background: color-mix(in srgb, var(--brand) 5%, var(--elev));
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table tbody tr {
    transition: background-color 0.2s ease;
}

.admin-table tbody tr:hover {
    background: color-mix(in srgb, var(--brand) 8%, var(--elev));
}

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

/* Badges de estado */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-published {
    background: color-mix(in srgb, var(--success) 15%, transparent);
    color: var(--success);
    border: 1px solid color-mix(in srgb, var(--success) 30%, var(--stroke));
}

.status-draft {
    background: color-mix(in srgb, var(--warning) 15%, transparent);
    color: var(--warning);
    border: 1px solid color-mix(in srgb, var(--warning) 30%, var(--stroke));
}

.status-archived {
    background: color-mix(in srgb, var(--muted) 15%, transparent);
    color: var(--muted);
    border: 1px solid color-mix(in srgb, var(--muted) 30%, var(--stroke));
}

.status-error {
    background: color-mix(in srgb, var(--error) 15%, transparent);
    color: var(--error);
    border: 1px solid color-mix(in srgb, var(--error) 30%, var(--stroke));
}

/* Botones de acción */
.action-buttons {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text);
}

.btn-icon:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-icon.primary {
    background: color-mix(in srgb, var(--brand) 15%, transparent);
    color: var(--brand);
}

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

.btn-icon.success {
    background: color-mix(in srgb, var(--success) 15%, transparent);
    color: var(--success);
}

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

.btn-icon.warning {
    background: color-mix(in srgb, var(--warning) 15%, transparent);
    color: var(--warning);
}

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

.btn-icon.danger {
    background: color-mix(in srgb, var(--error) 15%, transparent);
    color: var(--error);
}

.btn-icon.danger:hover {
    background: var(--error);
    color: white;
}

/* Modales administrativos */
.modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--elev);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--stroke);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text);
}

.modal-header button {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header button:hover {
    background: color-mix(in srgb, var(--brand) 15%, transparent);
    color: var(--brand);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--stroke);
    display: flex;
    gap: 0.8rem;
    justify-content: flex-end;
}

/* Estadísticas administrativas */
.stats-grid-admin {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card-admin {
    background: var(--elev);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card-admin::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand), var(--brand-light));
}

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

.stat-value-admin {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.stat-label-admin {
    color: var(--muted);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.8rem;
}

.stat-trend-admin {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--success) 10%, transparent);
    color: var(--success);
    margin-top: 0.5rem;
}

.stat-trend-admin.down {
    background: color-mix(in srgb, var(--error) 10%, transparent);
    color: var(--error);
}

/* Responsive para panel admin */
@media (max-width: 1024px) {
    .admin-layout {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--stroke);
    }
    
    .admin-nav {
        display: flex;
        overflow-x: auto;
        padding: 1rem 0;
        gap: 0.5rem;
    }
    
    .admin-nav-item {
        white-space: nowrap;
        margin: 0;
    }
    
    .admin-main {
        padding: 1rem;
    }
    
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .admin-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 768px) {
    .admin-form {
        padding: 1rem;
    }
    
    .form-section {
        margin-bottom: 1.5rem;
    }
    
    .admin-table {
        font-size: 0.9rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.6rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .stats-grid-admin {
        grid-template-columns: 1fr;
    }
    
    .stat-value-admin {
        font-size: 2rem;
    }
}

/* Loading states */
.loading-overlay {
    position: relative;
    pointer-events: none;
}

.loading-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 12px;
}

.spinner-admin {
    width: 40px;
    height: 40px;
    border: 4px solid var(--stroke);
    border-top: 4px solid var(--brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animaciones administrativas */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slideInLeft {
    animation: slideInLeft 0.5s ease-out;
}

.animate-slideInRight {
    animation: slideInRight 0.5s ease-out;
}

/* Estados de hover para elementos interactivos */
.interactive-element {
    transition: all 0.2s ease;
}

.interactive-element:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Utilidades administrativas */
.admin-text-muted {
    color: var(--muted);
}

.admin-text-brand {
    color: var(--brand);
}

.admin-bg-brand {
    background: var(--brand);
    color: white;
}

.admin-border-brand {
    border-color: var(--brand);
}

.admin-shadow {
    box-shadow: var(--shadow);
}

.admin-shadow-sm {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.admin-shadow-lg {
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}