/* style.css */

/* === VARIABLES GLOBALES === */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --light-gray: #ecf0f1;
    --medium-gray: #bdc3c7;
    --dark-gray: #7f8c8d;
    --text-color: #34495e;
    --white: #ffffff;
    --danger-color: #e74c3c;
    --success-color: #2ecc71;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --border-radius: 5px;
}

/* === RESET Y ESTILOS BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-gray);
}

.container {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 20px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* === NAVEGACIÓN PRINCIPAL === */
.main-nav {
    background-color: var(--white);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 15px 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-title {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--secondary-color);
}

.language-selector {
    display: flex;
    align-items: center;
}

.language-selector span {
    font-size: 1.2em;
    margin-right: 8px;
}

.language-selector select {
    padding: 5px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    background-color: var(--white);
}

/* === PÁGINA DE INICIO === */
.site-header {
    text-align: center;
    padding: 40px 0;
    border-bottom: 1px solid var(--medium-gray);
    margin-bottom: 40px;
}

.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.post-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.2s ease;
}

.post-card:hover {
    transform: translateY(-5px);
}

.post-card .post-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-card .post-content {
    padding: 20px;
}

.post-card h2 {
    margin-bottom: 10px;
}

.post-meta {
    font-size: 0.9em;
    color: var(--dark-gray);
    margin-bottom: 15px;
}

.post-meta span {
    margin-right: 15px;
}

.post-stats {
    margin-top: 15px;
    font-size: 0.9em;
}

.post-stats span {
    margin-right: 15px;
}

/* === PÁGINA DE POST INDIVIDUAL === */
.post-single {
    background-color: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
}

.post-single .featured-image {
    width: 100%;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.post-single .post-header {
    text-align: center;
    margin-bottom: 40px;
}

.post-single h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
}

.post-single .post-content {
    font-size: 1.1em;
    line-height: 1.8;
}

.post-single .post-content p { margin-bottom: 1.5em; }
.post-single .post-content h2 { margin: 1.5em 0 0.5em; }
.post-single .post-content h3 { margin: 1.2em 0 0.5em; }
.post-single .post-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1em;
    margin: 1.5em 0;
    font-style: italic;
    color: var(--dark-gray);
}

.post-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--light-gray);
}

.post-votes {
    display: flex;
    gap: 10px;
}

.vote-btn {
    background: none;
    border: 1px solid var(--medium-gray);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.vote-btn:hover {
    background-color: var(--light-gray);
}

.like-btn:hover { border-color: var(--success-color); }
.dislike-btn:hover { border-color: var(--danger-color); }

/* === POSTS RELACIONADOS === */
.related-posts {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--light-gray);
}

.related-posts h3 {
    margin-bottom: 20px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.related-post {
    background-color: var(--light-gray);
    padding: 15px;
    border-radius: var(--border-radius);
}

/* === FOOTER === */
.main-footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: var(--dark-gray);
    font-size: 0.9em;
}

/* === PÁGINA DE LOGIN === */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--secondary-color);
}

.login-container {
    background-color: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.login-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
}

.login-form button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1em;
}

/* === PANEL DE ADMINISTRACIÓN === */
.admin-body {
    background-color: #f4f6f9;
}

.admin-nav {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-nav a {
    color: var(--white);
    margin-left: 20px;
}

.admin-main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 30px;
}

.admin-tabs {
    display: flex;
    border-bottom: 1px solid var(--medium-gray);
    margin-bottom: 30px;
}

.tab-btn {
    padding: 15px 25px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 1em;
    color: var(--dark-gray);
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.admin-form {
    background-color: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.admin-form h2, .admin-form h3 {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1em;
}

.btn-primary { background-color: var(--primary-color); color: var(--white); }
.btn-secondary { background-color: var(--dark-gray); color: var(--white); }
.btn-danger { background-color: var(--danger-color); color: var(--white); }

/* Editor de contenido */
.language-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 20px;
}

.lang-tab {
    padding: 8px 15px;
    border: 1px solid var(--medium-gray);
    background-color: var(--light-gray);
    cursor: pointer;
    border-radius: var(--border-radius);
}

.lang-tab.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.language-content.hidden {
    display: none;
}

.editor-toolbar {
    border: 1px solid var(--medium-gray);
    border-bottom: none;
    padding: 10px;
    background-color: #f9f9f9;
}

.editor-toolbar button {
    margin-right: 5px;
    padding: 5px 10px;
    border: 1px solid var(--medium-gray);
    background-color: var(--white);
    cursor: pointer;
}

.content-editor {
    border: 1px solid var(--medium-gray);
    padding: 15px;
    min-height: 300px;
    outline: none;
}

/* Listas en Admin */
.posts-list, .languages-list, .connections-list {
    background-color: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
}

.post-item, .language-item, .connection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--light-gray);
}

.post-item:last-child, .language-item:last-child, .connection-item:last-child {
    border-bottom: none;
}

.post-details span, .badge {
    margin-left: 10px;
    font-size: 0.8em;
    padding: 3px 8px;
    border-radius: 10px;
    background-color: var(--light-gray);
}

.badge.active, .status-published { background-color: var(--success-color); color: var(--white); }
.badge.inactive, .status-draft { background-color: var(--dark-gray); color: var(--white); }

.btn-small {
    padding: 5px 10px;
    font-size: 0.9em;
    border-radius: var(--border-radius);
    border: 1px solid var(--medium-gray);
    background-color: var(--white);
    cursor: pointer;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .post-single {
        padding: 20px;
    }
    .post-single h1 {
        font-size: 2em;
    }
    .admin-nav {
        flex-direction: column;
        gap: 10px;
    }
    .admin-main {
        padding: 0 15px;
    }
}