* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #E63946;
    --primary-dark: #A4161A;
    --primary-light: #F77F88;
    --secondary: #F4B942;
    --accent: #DC7633;
    --accent-dark: #954535;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --light: #FFFAF0;
    --dark: #1A1A2E;
    --text: #2c3e50;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--light);
    color: var(--text);
    line-height: 1.7;
    transition: background 0.3s ease, color 0.3s ease;
}

body.dark {
    background: var(--dark);
    color: #f3f4f6;
}

body.dark {
    --border: #374151;
    --text-light: #d1d5db;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ====== HEADER & HERO ====== */

header.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    padding: 80px 0;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

header.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,.05) 10px, rgba(255,255,255,.05) 20px),
        repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(255,255,255,.03) 10px, rgba(255,255,255,.03) 20px);
    pointer-events: none;
}

body.dark header.hero {
    background: linear-gradient(135deg, #8B0000 0%, #D97706 100%);
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero-content p {
    font-size: 1.25rem;
    opacity: 0.95;
}

/* ====== SEARCH SECTION ====== */

.search-section {
    background: white;
    padding: 30px 0;
    margin-bottom: 50px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

body.dark .search-section {
    background: #1f2937;
    border-bottom-color: var(--border);
}

.search-form {
    display: flex;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.search-form input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    color: var(--text);
}

body.dark .search-form input {
    background: #374151;
    color: #f3f4f6;
    border-color: #4b5563;
}

.search-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

.search-form button {
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-form button:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--accent-dark) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.search-form button:active {
    transform: translateY(0);
}

/* ====== CATEGORY SECTIONS ====== */

.main-content {
    padding-bottom: 60px;
}

.category-section {
    margin-bottom: 60px;
}

.category-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 4px solid;
    border-image: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%) 1;
    color: var(--text);
}

body.dark .category-title {
    color: #f3f4f6;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

/* ====== ARTICLE CARDS ====== */

.article-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-top: 4px solid;
    border-image: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%) 1;
}

body.dark .article-card {
    background: #1f2937;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.card-image {
    display: none;
}

.article-card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-card-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 10px 0 12px 0;
    line-height: 1.4;
    color: var(--text);
}

body.dark .article-card-content h3 {
    color: #f3f4f6;
}

.article-card-content p {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 10px;
    line-height: 1.5;
    flex-grow: 1;
}

.article-card-content p.summary {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-content p.translation {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
}

.keyword-tag {
    display: inline-block;
    background: linear-gradient(135deg, rgba(230, 57, 70, 0.15) 0%, rgba(220, 118, 51, 0.15) 100%);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(230, 57, 70, 0.3);
    transition: all 0.2s ease;
}

body.dark .keyword-tag {
    background: rgba(230, 57, 70, 0.2);
    border-color: rgba(244, 185, 66, 0.4);
    color: #F4B942;
}

.keyword-tag:hover {
    background: rgba(230, 57, 70, 0.25);
    border-color: var(--primary);
}

/* ====== BADGES ====== */

.category-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--secondary) 0%, #F5C842 100%);
    color: #1a1a1a;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ====== ARTICLE PAGE ====== */

.article-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    padding: 40px 0;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.article-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,.05) 10px, rgba(255,255,255,.05) 20px),
        repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(255,255,255,.03) 10px, rgba(255,255,255,.03) 20px);
    pointer-events: none;
}

body.dark .article-header {
    background: linear-gradient(135deg, #8B0000 0%, #D97706 100%);
}

.article-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 20px 0;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

.article-keywords {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.keyword-tag-article {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.back-link {
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.back-link:hover {
    opacity: 0.8;
    transform: translateX(-4px);
}

/* ====== PAGE LAYOUT ====== */

.page-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 30px;
    margin-bottom: 60px;
}

@media (max-width: 768px) {
    .page-layout {
        grid-template-columns: 1fr;
    }
}

.article-main {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

body.dark .article-main {
    background: #1f2937;
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-content h3 {
    margin: 30px 0 15px 0;
    font-size: 1.4rem;
    color: var(--text);
}

body.dark .article-content h3 {
    color: #f3f4f6;
}

.article-summary {
    background: linear-gradient(135deg, rgba(230, 57, 70, 0.08) 0%, rgba(220, 118, 51, 0.08) 100%);
    padding: 20px;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    margin-bottom: 25px;
    font-style: italic;
}

body.dark .article-summary {
    background: rgba(230, 57, 70, 0.15);
}

.article-translation {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(244, 185, 66, 0.1) 0%, rgba(244, 185, 66, 0.05) 100%);
    border-radius: 8px;
    border-left: 4px solid var(--secondary);
}

body.dark .article-translation {
    background: rgba(244, 185, 66, 0.12);
}

.article-translation h3 {
    color: var(--secondary);
    margin-top: 0;
}

.article-link {
    margin-top: 30px;
}

.external-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    padding: 10px 20px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.external-link:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    transform: translateX(4px);
}

/* ====== SIDEBAR & RELATED ARTICLES ====== */

.article-sidebar {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 20px;
}

body.dark .article-sidebar {
    background: #1f2937;
}

.related-section h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
    border-bottom: 2px solid;
    border-image: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%) 1;
    padding-bottom: 10px;
}

body.dark .related-section h2 {
    color: #f3f4f6;
}

.related-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.related-card {
    padding: 15px;
    border-radius: 8px;
    background: var(--light);
    text-decoration: none;
    color: inherit;
    border-left: 4px solid var(--primary);
    transition: all 0.3s ease;
}

body.dark .related-card {
    background: #374151;
}

.related-card:hover {
    background: linear-gradient(135deg, rgba(230, 57, 70, 0.1) 0%, rgba(220, 118, 51, 0.1) 100%);
    transform: translateX(5px);
    border-left-color: var(--secondary);
}

body.dark .related-card:hover {
    background: #4b5563;
}

.related-card h3 {
    font-size: 0.95rem;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
}

body.dark .related-card h3 {
    color: #f3f4f6;
}

.related-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

.related-category {
    display: inline-block;
    font-size: 0.7rem;
    background: linear-gradient(135deg, var(--secondary) 0%, #F5C842 100%);
    color: #1a1a1a;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    margin-bottom: 5px;
}

/* ====== ERROR BOX ====== */

.error-box {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border: 2px solid var(--danger);
    color: var(--danger);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    font-weight: 500;
}

body.dark .error-box {
    background: rgba(239, 68, 68, 0.15);
}

/* ====== THEME TOGGLE ====== */

#theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

#theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 30px rgba(230, 57, 70, 0.3);
}

#theme-toggle:active {
    transform: scale(0.95);
}

body.dark #theme-toggle {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
}

/* ====== RESPONSIVE DESIGN ====== */

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content p {
        font-size: 1.1rem;
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .search-form {
        flex-direction: column;
    }

    .search-form input,
    .search-form button {
        width: 100%;
    }

    .article-header h1 {
        font-size: 2rem;
    }

    .article-main {
        padding: 25px;
    }

    .article-sidebar {
        position: static;
        top: auto;
    }

    #theme-toggle {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }

    .category-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero-content h1 {
        font-size: 1.8rem;
    }

    .hero-content p {
        font-size: 0.95rem;
    }

    header.hero {
        padding: 50px 0;
    }

    .search-form {
        gap: 8px;
    }

    .article-header h1 {
        font-size: 1.5rem;
    }

    .article-main {
        padding: 15px;
    }

    .article-content {
        font-size: 1rem;
    }

    .category-title {
        font-size: 1.3rem;
    }

    #theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ====== PAGE WRAPPER & LAYOUT ====== */

#page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#main-content {
    flex: 1;
}

/* ====== FOOTER ====== */

.footer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e5e7eb;
    padding: 60px 0 20px 0;
    margin-top: 60px;
    border-top: 3px solid var(--primary);
}

body.dark .footer {
    background: linear-gradient(135deg, #0f172a 0%, #1a2f5a 100%);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: white;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
}

.footer-section p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #d1d5db;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: #d1d5db;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.footer-section a:hover {
    color: var(--primary);
    transform: translateX(3px);
}

.social-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.social-link {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: rgba(230, 57, 70, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 0.85rem;
    color: #9ca3af;
}

.footer-bottom p {
    margin: 5px 0;
}

/* ====== COOKIES BANNER ====== */

.cookies-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

body.dark .cookies-banner {
    background: #1f2937;
    color: #f3f4f6;
}

.cookies-banner.show {
    transform: translateY(0);
}

.cookies-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cookies-content h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
}

.cookies-content > p {
    margin: 0 0 15px 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Granular Cookie Categories */
.cookies-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.cookie-category {
    display: flex;
}

.cookie-category label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    gap: 8px;
    font-size: 0.9rem;
}

.cookie-category input[type="checkbox"] {
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.cookie-category input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.cookie-category span {
    line-height: 1.3;
}

.cookies-links {
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 10px;
}

.cookies-links a {
    color: var(--primary);
    text-decoration: none;
    margin: 0 5px;
}

.cookies-links a:hover {
    text-decoration: underline;
}

.cookies-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(230, 57, 70, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    color: var(--text);
}

body.dark .btn-secondary {
    color: #f3f4f6;
    border-color: #4b5563;
}

body.dark .btn-secondary:hover {
    background: #4b5563;
}

/* ====== RESPONSIVE FOOTER ====== */

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    .cookies-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .cookies-categories {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .cookies-actions {
        width: 100%;
    }

    .cookies-actions .btn {
        flex: 1;
    }

    .footer {
        padding: 40px 0 20px 0;
    }

    .footer-section h3 {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .cookies-content {
        flex-direction: column;
        gap: 15px;
    }

    .cookies-content p {
        font-size: 0.85rem;
    }

    .cookies-actions {
        width: 100%;
        flex-direction: column;
    }

    .cookies-actions .btn {
        width: 100%;
    }
}