:root {
    --color-bg: #0f1117;
    --color-surface: #1a1d27;
    --color-surface-hover: #22263a;
    --color-border: #2d3348;
    --color-text: #e8eaef;
    --color-text-muted: #8b92a8;
    --color-primary: #6366f1;
    --color-primary-hover: #818cf8;
    --color-accent: #22d3ee;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Tema claro */
body[data-theme="light"] {
    --color-bg: #f6f7fb;
    --color-surface: #ffffff;
    --color-surface-hover: #f1f3f9;
    --color-border: #e2e6f2;
    --color-text: #0f172a;
    --color-text-muted: #4b5563;
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-accent: #0891b2;
    --shadow: 0 8px 28px rgba(2, 6, 23, 0.12);
}

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

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

a { color: var(--color-primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

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

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}

.logo-icon { color: var(--color-accent); }

.logo-image {
    height: 32px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.admin-link {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* Hero */
.hero {
    padding: 3rem 0 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-text), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    color: var(--color-text-muted);
    margin-top: 0.5rem;
    font-size: 1.1rem;
}

/* Boxes Grid */
.boxes-section { padding: 1rem 0 4rem; }

.boxes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.box-card {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.box-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-primary);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.box-image {
    aspect-ratio: 16/10;
    overflow: hidden;
    background: var(--color-bg);
}

.box-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.box-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-primary);
    background: linear-gradient(135deg, #1a1d27, #2d3348);
}

.box-info { padding: 1rem 1.25rem 1.25rem; }

.box-info h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.box-info p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.box-external {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0,0,0,0.6);
    color: var(--color-accent);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-muted);
}

/* App Page */
.app-page { padding: 2rem 0 4rem; }

.breadcrumb {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-primary-hover); }

.app-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.app-cover {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    object-fit: cover;
    flex-shrink: 0;
}

.app-header h1 { font-size: 2rem; font-weight: 700; }

.app-description {
    color: var(--color-text-muted);
    margin-top: 0.5rem;
}

.page-content { max-width: 800px; }

.content-block { margin-bottom: 1.5rem; }

.content-text { line-height: 1.8; }
.content-text h2, .content-text h3 { margin: 1rem 0 0.5rem; }
.content-text p { margin-bottom: 0.75rem; }
.content-text ul, .content-text ol { margin: 0.5rem 0 0.5rem 1.5rem; }

.content-image .lightbox-trigger {
    display: inline-block;
    max-width: 100%;
    cursor: zoom-in;
}

.content-image img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.content-image figcaption {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
    text-align: center;
}

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

.content-gallery .gallery-item {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4/3;
    padding: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: zoom-in;
    text-decoration: none;
    transition: border-color 0.2s;
}

.content-gallery .gallery-item:hover {
    border-color: var(--color-primary);
    text-decoration: none;
}

.content-gallery .gallery-item img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.88);
    cursor: zoom-out;
    animation: lightbox-fade-in 0.15s ease;
}

.lightbox-overlay .lightbox-image {
    max-width: min(100%, 96vw);
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 1;
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

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

.lightbox-counter {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

@keyframes lightbox-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.content-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--color-primary);
    color: #fff;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.content-link:hover {
    background: var(--color-primary-hover);
    text-decoration: none;
}

.content-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.content-links a {
    display: block;
    padding: 0.75rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    text-decoration: none;
    transition: border-color 0.2s;
}

.content-links a:hover {
    border-color: var(--color-primary);
    text-decoration: none;
}

.content-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

.content-form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.content-form h3 { margin-bottom: 1rem; }

.form-field { margin-bottom: 1rem; }

.form-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--color-text-muted);
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.95rem;
}

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

.content-form button {
    padding: 0.65rem 1.5rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.content-form button:hover { background: var(--color-primary-hover); }

.form-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #86efac;
}

body[data-theme="light"] .alert-success {
    color: #166534;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

body[data-theme="light"] .alert-error {
    color: #991b1b;
}

.app-pages-nav {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.app-pages-nav h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.app-pages-nav ul { list-style: none; }

.app-pages-nav a {
    display: block;
    padding: 0.5rem 0;
    color: var(--color-text-muted);
}

.app-pages-nav a.active,
.app-pages-nav a:hover { color: var(--color-primary-hover); }

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

/* Error page */
.error-page {
    text-align: center;
    padding: 6rem 2rem;
}

.error-page h1 { font-size: 4rem; color: var(--color-border); }
.error-page p { color: var(--color-text-muted); margin-top: 1rem; }
.error-page a { margin-top: 1.5rem; display: inline-block; }

@media (max-width: 640px) {
    .hero h1 { font-size: 1.75rem; }
    .boxes-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
    .app-header { flex-direction: column; }
}
