:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --bg-color: #f1f5f9;
    --surface: #ffffff;
    --surface-border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --error: #ef4444;
    --success: #10b981;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    font-size: 0.9375rem;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

.glass-panel {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    animation: fadeIn 0.4s ease-out;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--surface-border);
}

h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: #64748b;
    font-size: 0.875rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #000000;
    margin: 2rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title span {
    background: var(--primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
    .full-width {
        grid-column: 1 / -1;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
}

input, select, textarea {
    background: #ffffff;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    background: #ffffff;
    color: #000000;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-submit:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

.btn-full {
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

.btn-submit:active {
    transform: translateY(1px);
}

.info-box {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.action-btn { 
    background: #f8fafc; 
    border: 1px solid #e2e8f0; 
    color: #475569; 
    padding: 6px 12px; 
    border-radius: 8px; 
    cursor: pointer; 
    text-decoration: none; 
    font-size: 0.825rem; 
    font-weight: 500;
    transition: all 0.2s;
    display: inline-block;
}
.action-btn:hover { 
    background: #f1f5f9; 
    border-color: #cbd5e1;
    color: var(--primary);
}

/* Layout Administrativo */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

.sidebar {
    width: 260px;
    background: #ffffff;
    padding: 1.5rem;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: all 0.3s ease;
    z-index: 1000;
}

.admin-content {
    flex: 1;
    padding: 1.50rem 2rem;
    background: #f8fafc;
    min-height: 100vh;
    width: calc(100% - 260px);
    transition: all 0.3s ease;
}

.admin-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    width: 100%;
}

.header-info {
    text-align: right;
}

.info-label {
    font-size: 0.75rem;
    color: #94a3b8;
    display: block;
    margin-bottom: 0.25rem;
}

.info-value {
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    display: inline-block;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #64748b;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.nav-link.active {
    background: #eff6ff;
    color: var(--primary);
    font-weight: 600;
}

/* Toggle Sidebar para Móviles */
#sidebar-toggle {
    display: none;
    position: fixed;
    top: 1.25rem;
    left: 1.25rem;
    z-index: 1100;
    width: 45px;
    height: 45px;
    background: #0f172a; /* Dark background */
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Tablas Administrativas */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
}

table thead th {
    background: #f8fafc;
    color: #475569;
    text-align: left;
    padding: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
}

table tbody td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.nav-back {
    margin-bottom: 1.5rem;
}

.nav-back a {
    text-decoration: none;
    color: #64748b;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.nav-back a:hover {
    color: var(--primary);
}

/* Responsividad */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    .admin-content {
        width: calc(100% - 240px);
    }
}

@media (max-width: 768px) {
    .admin-layout {
        display: block !important;
    }

    #sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        box-shadow: 4px 0 25px rgba(0,0,0,0.15) !important;
        padding-top: 4rem !important;
        z-index: 9999 !important;
    }

    .sidebar.open {
        left: 0 !important;
    }

    .admin-content {
        padding: 5rem 1rem 2rem !important;
        width: 100% !important;
        margin-left: 0 !important;
        flex: none !important;
    }

    .admin-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .header-info {
        text-align: left;
    }

    .form-grid {
        grid-template-columns: 1fr !important;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-top: 1rem;
        border-radius: 8px;
        border: 1px solid var(--surface-border);
    }
    
    table {
        min-width: 600px; /* Forzar scroll en tablas anchas */
    }

    .glass-panel {
        padding: 1.25rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
}

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