/* Variables CSS personalizables */
:root {
    --primary-color: #1e3c72;
    --secondary-color: #faca31;
    --tertiary-color: #ffffff;
    --bg-color: #f7f8fb;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --sidebar-width: 280px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-color);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    background: white;
    padding: 12px 15px;
    border-radius: 12px;
    display: inline-block;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.sidebar-logo {
    max-width: 190px;
    height: auto;
    display: block;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-section {
    margin-bottom: 25px;
}

.nav-section-title {
    color: var(--secondary-color);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 10px 20px;
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.nav-item i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 25px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.social-links a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
}

.social-links a:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.top-bar {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    z-index: 100;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.top-bar h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.top-bar-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-admin {
    background: var(--primary-color);
    color: white;
}

.btn-admin:hover {
    background: #152a52;
}

.btn-logout {
    background: #dc3545;
    color: white;
}

.btn-logout:hover {
    background: #c82333;
}

/* ===== SERVICES CONTAINER ===== */
.services-container {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

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

.page-header h1 {
    font-size: 2.5rem;
    color: var(--text-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.page-header p {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.category-section {
    margin-bottom: 50px;
}

.category-section h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 10px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.service-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--secondary-color);
}

.service-card .icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.service-card:hover .icon {
    color: var(--secondary-color);
    transform: scale(1.1);
}

.service-card h3 {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.file-card h3 {
    font-size: 1rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 4.2em;
}

.service-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: break-word;
}

.favorite-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.favorite-btn:hover,
.favorite-btn.active {
    color: #ffd700;
    transform: scale(1.2);
}

.favorites-section {
    background: var(--primary-color);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 40px;
}

.favorites-section h2 {
    color: white;
    border-bottom-color: var(--secondary-color);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-toggle-btn {
        display: block;
    }

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

    .top-bar {
        padding: 10px 15px;
    }

    .top-bar-actions {
        gap: 5px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .service-card h3 {
        font-size: 1.1rem;
    }

    .file-card h3 {
        font-size: 0.9rem;
    }

    .page-header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .top-bar-left h1 {
        display: none;
        /* Ocultar "Dashboard" en móviles muy pequeños para dar espacio */
    }

    .btn span {
        display: none;
        /* Ocultar texto de botones, dejar solo iconos */
    }

    .btn {
        padding: 10px;
        width: 40px;
        height: 40px;
        justify-content: center;
    }

    .top-bar {
        padding: 10px 15px;
    }
}

/* Section View Styles */
#section-view {
    animation: fadeIn 0.3s ease-in-out;
}

.page-content-header {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
    border-left: 5px solid var(--primary-color);
}

.btn-back-home {
    transition: all 0.2s ease;
}

.btn-back-home:hover {
    transform: translateX(-5px);
    color: var(--secondary-color) !important;
}

#section-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.no-content {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    background: white;
    border-radius: 12px;
    color: #666;
    font-style: italic;
}

.btn-card-action {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 20px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-card-action:hover {
    background: var(--secondary-color);
}

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

/* File Cards & Download Items */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

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

.file-card .icon {
    font-size: 3.5rem;
}

.card-preview {
    width: 100%;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    display: block;
}

.video-preview video {
    width: 100%;
    max-height: 200px;
}

.audio-preview {
    padding: 10px;
}

.audio-preview audio {
    width: 100%;
}

.btn-card-action i {
    margin-right: 5px;
}

.file-card:hover {
    border-color: #1e3c72;
}

/* Grid Utilities for Contact Form */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -10px;
    margin-left: -10px;
}

.g-3 {
    --bs-gutter-y: 1rem;
    --bs-gutter-x: 1rem;
    margin-top: calc(-1 * var(--bs-gutter-y));
    margin-left: calc(-1/2 * var(--bs-gutter-x));
    margin-right: calc(-1/2 * var(--bs-gutter-x));
}

.g-3>* {
    padding-top: var(--bs-gutter-y);
    padding-left: calc(var(--bs-gutter-x) / 2);
    padding-right: calc(var(--bs-gutter-x) / 2);
}

.row>.col-12,
.row>.col-md-6,
.row>.col-md-4 {
    padding-right: 10px;
    padding-left: 10px;
    box-sizing: border-box;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

@media (max-width: 768px) {

    .col-md-6,
    .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

.contact-form-wrapper {
    background: #fff;
    border-radius: 12px;
}

.contact-form .form-group {
    margin-bottom: 0px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: #007bff;
    outline: none;
}

.btn-primary {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #0056b3;
}

.fw-bold {
    font-weight: 700 !important;
}

.text-muted {
    color: #6c757d !important;
}

.small {
    font-size: .875em !important;
}

.mb-1 {
    margin-bottom: 0.25rem !important;
}

.g-2 {
    --bs-gutter-y: 0.5rem;
    --bs-gutter-x: 0.5rem;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
}