/* ==========================================================================
   INPSIAT - Panel de Administración (Estética Kandinsky / Miró)
   ========================================================================== */

:root {
    --bg-color: #FAFAFA;
    --text-main: #1A1A1A;
    --accent-red: #E63946;
    --accent-blue: #1D3557;
    --accent-yellow: #F4A261;
    --accent-olive: #98A67E;
    /* INPSIAT Brand */
    --border-color: #E0E0E0;
    --panel-bg: #FFFFFF;
    --sans: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--sans);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(230, 57, 70, 0.03) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(29, 53, 87, 0.03) 0%, transparent 20%),
        radial-gradient(circle at 50% 50%, rgba(244, 162, 97, 0.03) 0%, transparent 40%);
    text-align: justify;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.kandinsky-shape {
    position: absolute;
    z-index: 0;
    opacity: 0.1;
}

.shape-circle {
    border-radius: 50%;
    background: var(--accent-red);
}

.shape-rect {
    background: var(--accent-blue);
    transform: rotate(15deg);
}

.shape-line {
    height: 4px;
    background: var(--text-main);
    transform: rotate(-35deg);
}

/* Container */
.admin-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    z-index: 1;
    position: relative;
}

/* ==========================================================================
   Login & Confidentiality View
   ========================================================================== */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--panel-bg);
    width: 100%;
    max-width: 500px;
    padding: 50px 40px;
    border-radius: 4px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.04);
    position: relative;
    border-top: 4px solid var(--accent-blue);
    border-left: 1px solid var(--border-color);
}

.login-box::before {
    content: '';
    position: absolute;
    top: -4px;
    right: 0;
    width: 30%;
    height: 4px;
    background: var(--accent-red);
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header img {
    height: 40px;
    margin-bottom: 20px;
}

.login-header a {
    text-decoration: none;
    cursor: pointer;
}

.login-header h1 {
    font-size: 1.5rem;
    color: var(--text-main);
}

.login-header p {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    font-size: 1rem;
    font-family: var(--sans);
    transition: all 0.3s ease;
    background: #F8F8F8;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: #FFF;
    box-shadow: 0 0 0 3px rgba(29, 53, 87, 0.1);
}

/* Confidentiality Clause */
.clause-box {
    background: rgba(244, 162, 97, 0.05);
    border-left: 3px solid var(--accent-yellow);
    padding: 20px;
    margin-bottom: 30px;
    font-size: 0.8rem;
    color: #444;
    line-height: 1.6;
    text-align: justify;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 30px;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 4px;
    width: 18px;
    height: 18px;
}

.checkbox-group label {
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    text-align: justify;
}

.btn-admin {
    display: inline-block;
    width: 100%;
    padding: 16px;
    background: var(--text-main);
    color: #FFF;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-admin:hover {
    background: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(29, 53, 87, 0.15);
}

.btn-admin:disabled {
    background: #CCC;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   Dashboard View
   ========================================================================== */
.dashboard-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--panel-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 30px 0;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.sidebar-brand {
    padding: 0 30px;
    margin-bottom: 50px;
}

.sidebar-brand img {
    height: 30px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    padding: 15px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #555;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #F9F9F9;
    color: var(--text-main);
}

.nav-item.active {
    background: rgba(29, 53, 87, 0.03);
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
    font-weight: 600;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    padding: 30px;
    margin-top: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--text-main);
    color: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-info h4 {
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.user-info span {
    font-size: 0.75rem;
    color: #888;
    background: #F0F0F0;
    padding: 2px 6px;
    border-radius: 20px;
    text-transform: uppercase;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 50px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
}

.page-title h2 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.page-title p {
    color: #666;
}

.action-buttons {
    display: flex;
    gap: 15px;
}

.btn-secondary {
    background: #FFF;
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 4px;
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--text-main);
}

/* Modules */
.dashboard-module {
    display: none;
    animation: fadeIn 0.3s ease;
}

.dashboard-module.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.metric-card {
    background: var(--panel-bg);
    padding: 30px;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.metric-card:nth-child(1)::before {
    background: var(--accent-blue);
}

.metric-card:nth-child(2)::before {
    background: var(--accent-red);
}

.metric-card:nth-child(3)::before {
    background: var(--accent-yellow);
}

.metric-icon {
    position: absolute;
    top: 30px;
    right: 30px;
    color: #EAEAEA;
    width: 40px;
    height: 40px;
}

.metric-card h3 {
    font-size: 3rem;
    margin: 10px 0;
}

.metric-card p {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.metric-trend {
    font-size: 0.85rem;
    color: #4CAF50;
    font-weight: 600;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Charts Area */
.charts-area {
    background: var(--panel-bg);
    padding: 40px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    min-height: 400px;
}

/* Forms (Podcast) */
.admin-form {
    background: var(--panel-bg);
    padding: 40px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    max-width: 800px;
}

.form-row {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
}

.form-row>.form-group {
    flex: 1;
    margin-bottom: 0;
}

textarea.form-control {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    font-family: var(--sans);
    resize: vertical;
    min-height: 200px;
    background: #F8F8F8;
    transition: all 0.3s ease;
}

textarea.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: #FFF;
}

.file-upload-box {
    border: 2px dashed var(--border-color);
    padding: 40px;
    text-align: center;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background: #FAFAFA;
}

.file-upload-box:hover {
    border-color: var(--accent-blue);
    background: #F0F4F8;
}

.file-upload-box svg {
    width: 40px;
    height: 40px;
    color: #888;
    margin-bottom: 15px;
}

/* Tables (Users) */
.table-container {
    background: var(--panel-bg);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

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

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

.admin-table th {
    background: #F9F9F9;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #555;
}

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

.role-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-super {
    background: rgba(230, 57, 70, 0.1);
    color: var(--accent-red);
}

.role-editor {
    background: rgba(244, 162, 97, 0.1);
    color: #D97706;
}

.role-assistant {
    background: rgba(29, 53, 87, 0.1);
    color: var(--accent-blue);
}

.action-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-right: 15px;
}

.action-link.danger {
    color: var(--accent-red);
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */
.admin-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    backdrop-filter: blur(8px);
}

.admin-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.admin-loading-logo {
    height: 120px;
    margin-bottom: 30px;
    filter: grayscale(100%) contrast(150%);
    animation: pulseLogo 1.5s infinite ease-in-out alternate;
}

@keyframes pulseLogo {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }

    100% {
        transform: scale(1.05);
        opacity: 1;
    }
}

.admin-loading-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-main);
    letter-spacing: 1px;
    animation: fadeInOut 2s infinite linear;
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}