/* ===========================
   Revista Romana - Estilos
   Clean & Minimal Design
   =========================== */

:root {
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-text-light: #666666;
    --color-accent: #2c2c2c;
    --color-border: #e5e5e5;
    --color-hover: #f5f5f5;
    --color-success: #2d7a3a;
    --color-error: #c0392b;
    --color-warning: #e67e22;
    --font-main: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Nunito Sans', Georgia, 'Times New Roman', serif;
    --max-width: 1200px;
    --radius: 4px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --transition: 0.2s ease;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: opacity var(--transition);
}

a:hover {
    opacity: 0.7;
}

/* Layout */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--color-border);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    background: var(--color-bg);
    z-index: 100;
}

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

.site-logo {
    display: flex;
    align-items: center;
}

.site-logo img {
    height: 90px;
    width: auto;
}

.site-tagline {
    font-size: 1.1rem;
    color: var(--color-text);
    font-weight: 500;
    letter-spacing: 0.3px;
    margin: 0;
}

.site-nav a {
    margin-left: 2rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-light);
}

.site-nav a:hover {
    color: var(--color-text);
    opacity: 1;
}

.btn-buy {
    display: inline-block;
    background: #c0392b;
    color: #fff !important;
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    opacity: 1 !important;
    transition: background var(--transition);
}

.btn-buy:hover {
    background: #a93226;
    color: #fff !important;
}

/* Main content */
main {
    flex: 1;
    padding: 3rem 0;
}

/* Hero / Latest Issue */
.hero {
    margin-bottom: 4rem;
}

.hero .section-title {
    margin-bottom: 2rem;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.hero-meta {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Issue Layout - Two columns: cover left, editorial right */
.issue-header {
    margin-bottom: 2rem;
}

.issue-header h1,
.issue-header .hero-title {
    font-family: var(--font-serif);
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.issue-header .issue-meta,
.issue-header .hero-meta {
    font-size: 1rem;
    color: var(--color-text-light);
}

.issue-layout {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 3rem;
    align-items: start;
}

.issue-layout-cover img {
    width: 100%;
    box-shadow: var(--shadow-hover);
    border-radius: var(--radius);
    transition: transform var(--transition), box-shadow var(--transition);
}

.issue-layout-cover a:hover img {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.issue-layout-editorial {
    padding-top: 0;
}

.editorial-heading {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-text-light);
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

/* Issues Grid */
.section-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-text-light);
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.issues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
}

.issue-card {
    display: block;
    transition: transform var(--transition);
}

.issue-card:hover {
    transform: translateY(-4px);
    opacity: 1;
}

.issue-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    transition: box-shadow var(--transition);
}

.issue-card:hover img {
    box-shadow: var(--shadow-hover);
}

.issue-card-title {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.issue-card-meta {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: 0.25rem;
}

/* Issue Page */
.issue-page {
    max-width: var(--max-width);
    margin: 0 auto;
}

.issue-page h1 {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.issue-page .issue-meta {
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.issue-section {
    margin-bottom: 3rem;
}

.issue-section h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.issue-section img {
    width: 100%;
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

.editorial-content {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--color-text);
}

.editorial-content p {
    margin-bottom: 1.25rem;
    text-align: justify;
}

.toc-content {
    font-size: 0.95rem;
    line-height: 1.6;
}

.toc-content ul {
    list-style: none;
    padding: 0;
}

.toc-content li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--color-border);
}

.toc-content li:last-child {
    border-bottom: none;
}

/* Page Thumbnails */
.page-thumbnails {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.page-thumbnails img {
    width: calc(20% - 0.4rem);
    aspect-ratio: 3/4;
    object-fit: cover;
    cursor: pointer;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: transform var(--transition), box-shadow var(--transition);
}

.page-thumbnails img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.lightbox-active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 2rem;
}

.lightbox-img-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    z-index: 1;
    border-radius: var(--radius);
}

.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: transform 0.15s ease;
    user-select: none;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 2;
    line-height: 1;
    opacity: 0.8;
    transition: opacity var(--transition);
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 2rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    z-index: 2;
    border-radius: var(--radius);
    opacity: 0.7;
    transition: opacity var(--transition), background var(--transition);
}

.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

.lightbox-controls {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 2;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    backdrop-filter: blur(8px);
}

.lightbox-controls button {
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.lightbox-controls button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-counter {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.back-link:hover {
    color: var(--color-text);
    opacity: 1;
}

/* Editions Carousel */
.editions-carousel-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.carousel-track-container {
    overflow: hidden;
    flex: 1;
}

.carousel-track {
    display: flex;
    gap: 1.5rem;
    transition: transform 0.4s ease;
}

.carousel-slide {
    flex: 0 0 calc((100% - 6rem) / 5);
    text-decoration: none;
    color: var(--color-text);
    text-align: center;
}

.carousel-slide img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}

.carousel-slide:hover img {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.carousel-slide-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.5rem;
    line-height: 1.3;
}

.carousel-slide-meta {
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin-top: 0.2rem;
}

.carousel-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), border-color var(--transition);
}

.carousel-btn:hover {
    background: var(--color-border);
    border-color: var(--color-text-light);
}

.carousel-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.8rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-light);
}

.empty-state p {
    font-size: 1.1rem;
}

/* ===========================
   Admin Styles
   =========================== */

.admin-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

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

.admin-header a {
    color: rgba(255, 255, 255, 0.75);
    transition: color 0.2s;
}

.admin-header a:hover {
    color: white;
    opacity: 1;
}

.admin-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.admin-nav a {
    margin-left: 1.5rem;
    font-size: 0.85rem;
}

/* Flash messages */
.flash {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flash-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.flash-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.flash-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Forms */
.form-group {
    margin-bottom: 1.75rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: var(--font-main);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.form-group .help-text {
    font-size: 0.78rem;
    color: var(--color-text-light);
    margin-top: 0.4rem;
}

/* Advanced section (collapsible) */
.advanced-section {
    margin-bottom: 1.75rem;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.advanced-section summary {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    background: #f8fafc;
    user-select: none;
    transition: background 0.2s;
}

.advanced-section summary:hover {
    background: #f1f5f9;
    color: #475569;
}

.advanced-section[open] summary {
    border-bottom: 1px solid var(--color-border);
}

.advanced-content {
    padding: 1.25rem 1rem 0.5rem;
}

/* Rich text toolbar */
.editor-wrapper {
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.editor-wrapper:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.editor-toolbar {
    display: flex;
    gap: 2px;
    padding: 0.5rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--color-border);
}

.editor-toolbar button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.editor-toolbar button:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.editor-toolbar button.active {
    background: #3b82f6;
    color: white;
}

.editor-toolbar .separator {
    width: 1px;
    background: var(--color-border);
    margin: 4px 6px;
}

.editor-content {
    min-height: 200px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: var(--font-main);
    line-height: 1.7;
    outline: none;
}

.editor-content:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
}

.editor-content p {
    margin-bottom: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: var(--font-main);
}

.btn-primary {
    background: #3b82f6;
    color: white;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: #2563eb;
    opacity: 1;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    opacity: 1;
    color: white;
}

.btn-secondary {
    background: white;
    color: var(--color-text);
    border: 1.5px solid var(--color-border);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    opacity: 1;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.78rem;
    border-radius: 6px;
}

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.88rem;
}

.admin-table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid var(--color-border);
}

.admin-table td {
    border-bottom: 1px solid #f1f5f9;
}

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

.admin-table tr:hover td {
    background: #f8fafc;
}

.admin-table img {
    width: 50px;
    height: 67px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.badge-success {
    background: #ecfdf5;
    color: #065f46;
}

.badge-warning {
    background: #fffbeb;
    color: #92400e;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.login-box {
    width: 100%;
    max-width: 380px;
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.login-box h1 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.login-box p {
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.login-box .btn {
    width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .site-header .container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .site-nav a {
        margin: 0 0.75rem;
    }

    .issue-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .issue-layout-cover img {
        max-width: 300px;
        margin: 0 auto;
    }

    .issues-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1.25rem;
    }

    .issue-page h1 {
        font-size: 1.5rem;
    }

    .issue-header h1,
    .issue-header .hero-title {
        font-size: 2rem;
    }

    .carousel-slide {
        flex: 0 0 calc((100% - 3rem) / 3);
    }

    .admin-table {
        font-size: 0.8rem;
    }

    .admin-table th:nth-child(3),
    .admin-table td:nth-child(3) {
        display: none;
    }
}

@media (max-width: 480px) {
    .carousel-slide {
        flex: 0 0 calc((100% - 1.5rem) / 2);
    }
}
