:root {
    --primary: #1e3a8a;
    --secondary: #3b82f6;
    --accent: #f59e0b;
    --background: #f8fafc;
    --text: #0f172a;
    --text-light: #64748b;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--background);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.025em;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.nav-links a:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.search-box {
    margin: 2rem 0;
    text-align: center;
    position: relative;
}

.search-form {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 1rem 4rem 1rem 1.5rem;
    font-size: 1.125rem;
    border: 2px solid var(--border);
    border-radius: 9999px;
    outline: none;
    transition: border-color 0.2s;
    box-shadow: var(--shadow);
}

.search-input:focus {
    border-color: var(--secondary);
}

.search-button {
    position: absolute;
    right: 0.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.search-button:hover {
    background: var(--secondary);
    transform: scale(1.05);
}

.search-button:active {
    transform: scale(0.95);
}

.grid {
    display: grid;
    gap: 1.5rem;
    margin: 2rem 0;
    align-items: start;
    /* Prevent stretching to match tallest item */
}

/* Home Grid (Series) / Card Grid (Cards in Series) */
.grid-home,
.grid-serie {
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 640px) {

    .grid-home,
    .grid-serie {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {

    .grid-home,
    .grid-serie {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {

    .grid-home,
    .grid-serie {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 1280px) {

    .grid-home,
    .grid-serie {
        grid-template-columns: repeat(6, 1fr);
    }
}

.card-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

.card-img-wrapper {
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: #f1f5f9;
    position: relative;
}

.card-img-wrapper.vertical {
    aspect-ratio: 2 / 3;
}

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

.card-content {
    padding: 1rem;
}

.card-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    font-size: 0.875rem;
    color: var(--text-light);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 3rem 0;
    flex-wrap: wrap;
}
}

.page-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-weight: 500;
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Detail Pages */
.detail-header {
    margin-bottom: 2rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.share-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.btn-whatsapp:hover {
    background: #25D366;
    color: white;
    border-color: #25D366;
}

.btn-telegram:hover {
    background: #0088cc;
    color: white;
    border-color: #0088cc;
}

.btn-share#shareButton:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-report-error:hover {
    background: #ef4444;
    /* red-500 */
    color: white;
    border-color: #ef4444;
}

.detail-title {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.detail-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-light);
    font-size: 1rem;
}

.detail-text {
    font-size: 1.125rem;
    color: var(--text);
    margin-bottom: 2rem;
}

/* Card Detail Specific */
.card-viewer {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 3rem;
}

.image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .image-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        justify-items: center;
        align-items: flex-start;
        gap: 2rem;
    }
}

.image-box {
    background: white;
    padding: 0.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 100%;
    flex: 0 1 auto;
}

.image-box img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.image-box.horizontal {
    max-width: 600px;
}

.image-box.horizontal img {
    width: 100%;
    height: auto;
}

.image-box.vertical img {
    max-height: 500px;
    width: auto;
}

.tech-info {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 2rem;
}

.tech-info h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

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

.tech-item span {
    display: block;
    font-size: 0.875rem;
    color: var(--text-light);
}

.tech-item strong {
    font-size: 1rem;
}

.tiragem-list {
    margin-top: 0.25rem;
}

.tiragem-entry {
    font-size: 0.9375rem;
    line-height: 1.4;
}

.tiragem-entry strong {
    font-size: 0.9375rem;
    color: var(--text);
}

/* Ads */
.ad-container {
    margin: 2rem 0;
    text-align: center;
    background: #f1f5f9;
    border: 1px dashed #cbd5e1;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Search Results Overlay */
.search-results-overlay {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1);
    border: 1px solid var(--border);
    z-index: 50;
    display: none;
    text-align: left;
    margin-top: 0.5rem;
}

.search-results-overlay.active {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    text-decoration: none;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f8fafc;
}

.search-result-image {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    background: #f1f5f9;
}

.search-result-info {
    flex: 1;
}

.search-result-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--secondary);
    display: block;
    margin-bottom: 0.1rem;
}

.search-result-title {
    font-weight: 600;
    color: var(--text);
}

.search-result-subtitle {
    font-size: 0.875rem;
    color: var(--text-light);
}

.search-no-results {
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
}

/* Image Zoom Modal */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

.image-modal.active {
    display: flex;
}

.image-modal-content {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
}

.zoomable {
    cursor: zoom-in;
    transition: opacity 0.2s;
}

.zoomable:hover {
    opacity: 0.9;
}

/* Related Cards Section */
.related-cards {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.grid-related {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.card-item-mini {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: transform 0.2s;
}

.card-item-mini:hover {
    transform: translateY(-2px);
}

.card-img-wrapper.mini {
    width: 100%;
    aspect-ratio: 3 / 2;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-img-wrapper.mini.vertical {
    aspect-ratio: 2 / 3;
}

.card-content-mini {
    padding-top: 0.75rem;
}

.card-title-mini {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
    display: block;
    line-height: 1.4;
}

@media (max-width: 640px) {
    .container {
        padding: 0 1rem;
    }

    .grid-related {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .header-top {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .share-group {
        width: 100%;
        justify-content: flex-start;
    }

    .breadcrumb {
        width: 100%;
        font-size: 0.875rem;
    }
}

footer {
    background: white;
    border-top: 1px solid var(--border);
    padding: 3rem 0;
    margin-top: 4rem;
    text-align: center;
    color: var(--text-light);
}