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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.8rem;
    color: #333;
}

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

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 20px;
}

nav ul li a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: color 0.3s;
}

nav ul li a:hover {
    color: #007bff;
}

/* Main content */
main {
    padding: 40px 0;
    min-height: calc(100vh - 160px);
}

h2 {
    margin-bottom: 30px;
    color: #333;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

h3 {
    margin-bottom: 20px;
    color: #444;
}

/* Posts grid */
.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.post {
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.post:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
}

.post-header {
    padding: 20px 20px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: #333;
}

.post-date {
    color: #777;
    font-size: 0.9rem;
}

.post-media {
    position: relative;
    overflow: hidden;
}

.post-media img,
.post-media video {
    width: 100%;
    height: auto;
    display: block;
}

.post-media video {
    max-height: 500px;
    object-fit: contain;
    background-color: #000;
}

.media-slider {
    position: relative;
    overflow: hidden;
}

.media-slide {
    display: none;
    animation: fade 0.5s;
}

.media-slide.active {
    display: block;
}

@keyframes fade {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

.slider-prev,
.slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255,255,255,0.8);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.slider-prev:hover,
.slider-next:hover {
    background-color: rgba(255,255,255,1);
}

.slider-prev {
    left: 10px;
}

.slider-next {
    right: 10px;
}

.post-content {
    padding: 20px;
}

.post-content p {
    margin: 0;
    color: #555;
    line-height: 1.7;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    gap: 5px;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 16px;
    text-decoration: none;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s;
}

.pagination a:hover {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination .current {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Forms */
.contact-form,
.login-form,
.post-form {
    max-width: 600px;
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #444;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group textarea,
.form-group select,
.form-group input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
}

.form-group textarea {
    resize: vertical;
}

.form-help {
    font-size: 0.85rem;
    color: #777;
    margin-top: 5px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.3s;
    text-align: center;
}

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

.btn-large {
    padding: 12px 24px;
    font-size: 1.1rem;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-success {
    background-color: #28a745;
}

.btn-success:hover {
    background-color: #1e7e34;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.85rem;
    margin-right: 5px;
}

/* Messages */
.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

/* Admin dashboard */
.admin-header {
    background-color: #343a40;
    color: white;
}

.admin-header h1 {
    color: white;
}

.admin-header nav ul li a {
    color: rgba(255,255,255,0.8);
}

.admin-header nav ul li a:hover {
    color: white;
}

.admin-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f5f5f5;
}

.login-container {
    background-color: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.login-info {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2rem;
    color: #007bff;
    margin-right: 20px;
}

.stat-info h3 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    color: #777;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
}

.dashboard-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.posts-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.posts-table th,
.posts-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.posts-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.posts-table tr:hover {
    background-color: #f9f9f9;
}

.posts-table .actions {
    white-space: nowrap;
}

.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.active {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background-color: #f8d7da;
    color: #721c24;
}

/* Edit post */
.edit-post-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.edit-section {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.medios-form {
    margin-top: 20px;
}

.medios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.medio-item {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f9f9f9;
}

.medio-preview {
    position: relative;
    height: 150px;
    overflow: hidden;
}

.medio-preview img,
.medio-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.medio-actions {
    position: absolute;
    top: 10px;
    right: 10px;
}

.medio-info {
    padding: 15px;
}

.medio-info p {
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.medio-info .form-group {
    margin-bottom: 0;
}

.medio-info label {
    font-size: 0.85rem;
    margin-bottom: 3px;
}

.medio-info input {
    padding: 5px;
    font-size: 0.85rem;
}

.edit-post-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/* Preview container */
.preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.preview-container img,
.preview-container video {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Footer */
footer {
    background-color: #f8f9fa;
    padding: 20px 0;
    text-align: center;
    color: #666;
    border-top: 1px solid #eee;
}

/* Responsive */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        text-align: center;
    }
    
    nav ul {
        margin-top: 15px;
        justify-content: center;
    }
    
    nav ul li {
        margin: 0 10px;
    }
    
    .posts-table th,
    .posts-table td {
        padding: 10px 5px;
        font-size: 0.9rem;
    }
    
    .dashboard-actions {
        flex-direction: column;
    }
    
    .medios-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

        /* Estilos adicionales para posts de tamaño fijo - 2 POR FILA */
        .posts-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr); /* 2 columnas fijas */
            gap: 30px;
        }
        
        @media (max-width: 1024px) {
            .posts-grid {
                gap: 25px;
            }
        }
        
        @media (max-width: 768px) {
            .posts-grid {
                grid-template-columns: 1fr; /* 1 columna en móviles */
                gap: 20px;
                max-width: 500px;
                margin: 0 auto;
            }
        }
        
        .post {
            display: flex;
            flex-direction: column;
            height: 650px; /* Altura fija ligeramente mayor para 2 por fila */
            max-height: 650px;
            overflow: hidden;
            background-color: #fff;
            border-radius: 12px;
            box-shadow: 0 5px 20px rgba(0,0,0,0.1);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        
        .post:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 30px rgba(0,0,0,0.15);
        }
        
        .post-header {
            padding: 20px 20px 15px;
            border-bottom: 1px solid #f0f0f0;
            flex-shrink: 0;
        }
        
        .post-header h3 {
            margin: 0 0 5px 0;
            font-size: 1.3rem;
            color: #333;
            line-height: 1.4;
        }
        
        .post-date {
            font-size: 0.85rem;
            color: #888;
        }
        
        .post-media {
            position: relative;
            flex: 1;
            overflow: hidden;
            background-color: #f8f8f8;
            min-height: 380px; /* Más alto para 2 por fila */
            max-height: 380px;
        }
        
        .post-media img,
        .post-media video {
            width: 100%;
            height: 100%;
            object-fit: contain;
            display: block;
            cursor: pointer;
            transition: transform 0.3s ease;
        }
        
        .post-media img:hover {
            transform: scale(1.02);
        }
        
        /* Contenedor para imágenes con relación de aspecto fija */
        .media-container {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #f8f8f8;
        }
        
        /* Slider para múltiples imágenes */
        .media-slider {
            position: relative;
            width: 100%;
            height: 100%;
        }
        
        .media-slide {
            display: none;
            width: 100%;
            height: 100%;
            animation: fade 0.5s;
        }
        
        .media-slide.active {
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .media-slide img,
        .media-slide video {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
        }
        
        .slider-prev,
        .slider-next {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background-color: rgba(0,0,0,0.5);
            color: white;
            border: none;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background-color 0.3s;
            z-index: 10;
        }
        
        .slider-prev:hover,
        .slider-next:hover {
            background-color: rgba(0,0,0,0.8);
        }
        
        .slider-prev {
            left: 10px;
        }
        
        .slider-next {
            right: 10px;
        }
        
        .slider-dots {
            position: absolute;
            bottom: 15px;
            left: 0;
            right: 0;
            display: flex;
            justify-content: center;
            gap: 8px;
            z-index: 10;
        }
        
        .slider-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: rgba(255,255,255,0.5);
            border: none;
            cursor: pointer;
            transition: background-color 0.3s;
            padding: 0;
        }
        
        .slider-dot.active {
            background-color: rgba(255,255,255,1);
        }
        
        .post-content {
            padding: 20px;
            border-top: 1px solid #f0f0f0;
            overflow-y: auto;
            max-height: 180px;
            flex-shrink: 0;
        }
        
        .post-content p {
            margin: 0;
            color: #555;
            line-height: 1.6;
            font-size: 0.95rem;
        }
        
        /* Scrollbar personalizada para el contenido */
        .post-content::-webkit-scrollbar {
            width: 6px;
        }
        
        .post-content::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 3px;
        }
        
        .post-content::-webkit-scrollbar-thumb {
            background: #c1c1c1;
            border-radius: 3px;
        }
        
        .post-content::-webkit-scrollbar-thumb:hover {
            background: #a8a8a8;
        }
        
        /* Lightbox personalizado */
        .lightbox-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.9);
            z-index: 9999;
            justify-content: center;
            align-items: center;
        }
        
        .lightbox-overlay.active {
            display: flex;
        }
        
        .lightbox-content {
            position: relative;
            max-width: 90%;
            max-height: 90%;
        }
        
        .lightbox-image {
            max-width: 100%;
            max-height: 90vh;
            object-fit: contain;
        }
        
        .lightbox-close {
            position: absolute;
            top: -40px;
            right: 0;
            background: none;
            border: none;
            color: white;
            font-size: 2rem;
            cursor: pointer;
        }
        
        .lightbox-prev,
        .lightbox-next {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background-color: rgba(255,255,255,0.2);
            color: white;
            border: none;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            font-size: 1.5rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background-color 0.3s;
        }
        
        .lightbox-prev:hover,
        .lightbox-next:hover {
            background-color: rgba(255,255,255,0.4);
        }
        
        .lightbox-prev {
            left: 20px;
        }
        
        .lightbox-next {
            right: 20px;
        }
        
        .lightbox-caption {
            color: white;
            text-align: center;
            margin-top: 20px;
            font-size: 1.1rem;
        }
        
        /* Indicador de múltiples imágenes */
        .multi-media-indicator {
            position: absolute;
            top: 15px;
            right: 15px;
            background-color: rgba(0,0,0,0.7);
            color: white;
            padding: 5px 10px;
            border-radius: 20px;
            font-size: 0.8rem;
            z-index: 5;
        }
        
        /* Controles de video */
        video {
            background-color: #000;
        }
        
        @keyframes fade {
            from { opacity: 0.4; }
            to { opacity: 1; }
        }
        
        /* Estado cuando no hay medios */
        .no-media {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: #999;
            font-style: italic;
        }
        
        /* Ajustes para pantallas muy grandes */
        @media (min-width: 1400px) {
            .posts-grid {
                grid-template-columns: repeat(2, minmax(500px, 1fr));
                gap: 40px;
            }
            
            .post {
                height: 700px;
            }
            
            .post-media {
                min-height: 400px;
                max-height: 400px;
            }
        }
        
        /* Ajustes para pantallas medianas */
        @media (max-width: 480px) {
            .post {
                height: 580px; /* Un poco más bajo en móviles */
            }
            
            .post-media {
                min-height: 300px;
                max-height: 300px;
            }
            
            .post-header {
                padding: 15px;
            }
            
            .post-content {
                padding: 15px;
                max-height: 150px;
            }
        }
