:root {
    /* Color Palette */
    --bg-color: #FAFAFA;
    --container-bg: #FFFFFF;
    --primary-color: #7E212A;
    /* Burgundy */
    --accent-color: #B08E51;
    /* Gold */
    --text-main: #555555;
    --text-light: #666666;
    --text-muted: #999999;
    --border-color: #EAEAEA;
    --border-dark: #E0E0E0;

    /* Typography */
    --font-family: 'Montserrat', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 40px 20px;
    position: relative;
    overflow-x: hidden;
}


/* Main Container */
.container {
    width: 100%;
    max-width: 1200px;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 30px;
}

.logo {
    max-width: 220px;
    height: auto;
    margin-bottom: 10px;
}

.logo-subtitle {
    color: var(--accent-color);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.divider {
    height: 1px;
    background-color: var(--border-color);
    width: 80%;
    margin: 25px auto;
}

.page-title {
    color: var(--primary-color);
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 10px;
}

.page-description {
    color: var(--text-light);
    font-size: 15px;
    font-weight: 300;
}

/* Dashboard Grid Component */
.dashboard-grid {
    padding: 0 40px 30px 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.category {
    background-color: #fdfdfd;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.category-title {
    color: var(--accent-color);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.category-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--primary-color);
    margin-right: 10px;
    border-radius: 50%;
}

.links-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
    gap: 15px;
}

/* Link Card Styles & Animations */
.link-card {
    display: flex;
    align-items: center;
    text-decoration: none;
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 6px;
    color: var(--text-main);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.link-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: var(--accent-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
    transform-origin: bottom;
}

.link-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    border-color: transparent;
}

.link-card:hover::before {
    transform: scaleY(1);
}

.icon-wrapper {
    background-color: transparent;
    color: var(--accent-color);
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    margin-right: 20px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.icon-wrapper svg,
.icon-wrapper img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.link-text {
    display: flex;
    flex-direction: column;
}

.link-text strong {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 3px;
    transition: color 0.3s ease;
}

.link-text span {
    font-size: 12px;
    color: var(--text-muted);
}

.link-card:hover .link-text strong {
    color: var(--accent-color);
}

/* Primary Highlight Link Card */
.feature-primary {
    background: linear-gradient(145deg, var(--primary-color) 0%, #5f1820 100%);
    color: white;
    border: none;
}

.feature-primary .icon-wrapper {
    background-color: transparent;
    color: white;
}

.feature-primary .link-text strong {
    color: white;
}

.feature-primary .link-text span {
    color: rgba(255, 255, 255, 0.8);
}

.feature-primary:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 24px rgba(126, 33, 42, 0.3);
}

.feature-primary:hover .link-text strong {
    color: var(--accent-color);
}

/* Support CTA Section */
.support-box {
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 35px 40px;
    text-align: center;
    margin-top: 10px;
}

.support-box p {
    color: var(--text-light);
    font-size: 15px;
    margin-bottom: 20px;
    font-weight: 500;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    background-color: var(--accent-color);
    color: white;
    padding: 14px 30px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 1px;
    border-radius: 4px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(126, 33, 42, 0.2);
}

/* Footer Element */
.footer {
    text-align: center;
    background-color: #F8F8F8;
    padding: 40px 20px;
}

.footer .brand {
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.footer .address {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.footer .copyright {
    color: #CCCCCC;
    font-size: 11px;
}

/* Search Container */
.search-container {
    max-width: 500px;
    margin: 30px auto 0;
    position: relative;
}

.search-container input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    border: 1.5px solid rgba(176, 142, 81, 0.3);
    border-radius: 30px;
    font-size: 15px;
    font-family: var(--font-family);
    color: var(--text-main);
    outline: none;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #fcfaf5 0%, #f0e6d2 50%, #e8d5b0 100%);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.05);
}

.search-container input::placeholder {
    color: rgba(85, 85, 85, 0.6);
}

.search-container input:focus {
    border-color: rgba(176, 142, 81, 0.8);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06), 0 6px 20px rgba(176, 142, 81, 0.25);
    transform: translateY(-2px);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--accent-color);
    pointer-events: none;
}

.clear-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--accent-color);
    cursor: pointer;
    display: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
}

.clear-icon:hover {
    opacity: 1;
    color: var(--primary-color);
    transform: translateY(-50%) scale(1.15) rotate(90deg);
}

/* Footer Social Links */
.social-links {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.social-links img {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.social-links a:hover img {
    transform: translateY(-3px) scale(1.1);
}

/* Base Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.animate-slide-up {
    opacity: 0;
    /* starts hidden */
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: calc(var(--animation-order) * 0.15s + 0.2s);
}

/* Responsive Styles */
@media screen and (max-width: 600px) {
    body {
        padding: 0;
        /* Remove body padding on mobile so container fills screen */
        background-color: var(--container-bg);
    }

    .header {
        padding: 30px 20px;
    }

    .dashboard-grid {
        padding: 0 20px 20px 20px;
        gap: 20px;
    }

    .category {
        padding: 15px;
    }

    .support-box {
        padding: 30px 20px;
    }

    .links-group {
        grid-template-columns: 1fr;
    }
}

/* Theme Toggle Switch */
.theme-toggle-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle-wrapper:focus-visible .toggle-track {
    box-shadow: 0 0 0 3px rgba(176, 142, 81, 0.4);
}

.toggle-track {
    position: relative;
    width: 62px;
    height: 30px;
    border-radius: 30px;
    background: linear-gradient(135deg, #f0e6d2 0%, #e8d5b0 50%, #d8c49a 100%);
    border: 1.5px solid rgba(176, 142, 81, 0.3);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(255,255,255,0.5);
}

.toggle-track:hover {
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06), 0 2px 12px rgba(176, 142, 81, 0.25);
}

/* Stars (hidden in light mode, visible in dark) */
.toggle-stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.toggle-stars .star {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    transition: opacity 0.4s ease 0.2s;
}

/* The sliding thumb */
.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffffff 0%, #f5f0e6 100%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.thumb-icon {
    width: 14px;
    height: 14px;
    position: absolute;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

/* Light mode: show sun, hide moon */
.sun-icon {
    color: #B08E51;
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.moon-icon {
    color: #d8b87b;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

/* ===== Dark mode active state ===== */
.theme-toggle-wrapper.is-dark .toggle-track {
    background: linear-gradient(135deg, #1a1333 0%, #2a1f4e 50%, #1e1640 100%);
    border-color: rgba(176, 142, 81, 0.2);
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.2);
}

.theme-toggle-wrapper.is-dark .toggle-track:hover {
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.4), 0 2px 14px rgba(216, 184, 123, 0.2);
}

.theme-toggle-wrapper.is-dark .toggle-thumb {
    left: calc(100% - 25px);
    background: linear-gradient(145deg, #2c2450 0%, #3a2d68 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 0 12px rgba(216, 184, 123, 0.15);
}

.theme-toggle-wrapper.is-dark .sun-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.theme-toggle-wrapper.is-dark .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    color: #d8b87b;
}

.theme-toggle-wrapper.is-dark .toggle-stars .star {
    opacity: 1;
    animation: twinkle 2s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.3; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.2); }
}

/* Dark Mode Variables and Overrides */
[data-theme="dark"] {
    --bg-color: #121212;
    --container-bg: #1e1e1e;
    --primary-color: #d15664; /* Lighter burgundy/red for dark mode */
    --accent-color: #d8b87b; /* Lighter gold */
    --text-main: #f0f0f0;
    --text-light: #cccccc;
    --text-muted: #999999;
    --border-color: #333333;
    --border-dark: #444444;
}

[data-theme="dark"] .category {
    background-color: #252525;
    border-color: #333333;
}

[data-theme="dark"] .footer {
    background-color: #1a1a1a;
}

[data-theme="dark"] .support-box {
    background-color: #1a1a1a;
}

[data-theme="dark"] .search-container input {
    color: var(--text-main);
    background: linear-gradient(135deg, #1a1333 0%, #2a1f4e 50%, #1e1640 100%);
    border-color: rgba(176, 142, 81, 0.3);
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2);
}

[data-theme="dark"] .search-container input::placeholder {
    color: rgba(240, 240, 240, 0.5);
}

[data-theme="dark"] .search-container input:focus {
    border-color: rgba(216, 184, 123, 0.6);
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.4), 0 6px 20px rgba(216, 184, 123, 0.2);
}

[data-theme="dark"] .search-icon,
[data-theme="dark"] .clear-icon {
    color: var(--accent-color);
}

/* ============================================================= */
/* Popup / Modal de texto com links                              */
/* ============================================================= */

/* Card que dispara o popup (reaproveita .link-card como <button>) */
.popup-trigger {
    width: 100%;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

/* Pequeno selo "abrir" no canto do card */
.popup-trigger .popup-badge {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-color);
    opacity: 0.8;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.popup-trigger:hover .popup-badge {
    opacity: 1;
    transform: translateX(2px);
}

.popup-trigger .popup-badge svg {
    width: 14px;
    height: 14px;
}

/* Fundo escurecido / overlay */
.popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(20, 10, 12, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* Caixa do popup */
.popup-box {
    position: relative;
    width: 100%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    transform: translateY(16px) scale(0.97);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.35s ease;
}

.popup-overlay.is-open .popup-box {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Faixa superior decorativa */
.popup-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 16px 16px 0 0;
}

/* Cabeçalho */
.popup-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 26px 28px 16px 28px;
}

.popup-header .popup-icon {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--primary-color) 0%, #5f1820 100%);
}

.popup-header .popup-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.popup-header h3 {
    font-size: 19px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.25;
}

.popup-header .popup-subtitle {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--accent-color);
}

/* Botão fechar */
.popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.popup-close:hover {
    background: rgba(126, 33, 42, 0.08);
    color: var(--primary-color);
    transform: rotate(90deg);
}

.popup-close svg {
    width: 20px;
    height: 20px;
}

/* Corpo do texto */
.popup-body {
    padding: 6px 28px 28px 28px;
}

.popup-body p {
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--text-light);
    margin-bottom: 14px;
}

.popup-body h4 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent-color);
    margin: 22px 0 10px 0;
    display: flex;
    align-items: center;
}

.popup-body h4::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    margin-right: 9px;
}

.popup-body ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.popup-body li {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-light);
    padding-left: 16px;
    position: relative;
}

.popup-body li::before {
    content: '›';
    position: absolute;
    left: 0;
    top: -1px;
    color: var(--accent-color);
    font-weight: 700;
}

/* Links dentro do popup */
.popup-body a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1.5px solid rgba(176, 142, 81, 0.4);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.popup-body a:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.popup-body .popup-note {
    margin-top: 22px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(176, 142, 81, 0.08);
    border: 1px solid rgba(176, 142, 81, 0.2);
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* Botão de ação principal no rodapé do popup */
.popup-body .popup-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 12px 22px;
    border-radius: 8px;
    background: linear-gradient(145deg, var(--primary-color) 0%, #5f1820 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.popup-body .popup-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(126, 33, 42, 0.25);
    color: #fff;
    border: none;
}

.popup-body .popup-cta svg {
    width: 16px;
    height: 16px;
}

/* Bloqueia rolagem do fundo quando o popup está aberto */
body.popup-locked {
    overflow: hidden;
}

@media (max-width: 600px) {
    .popup-header,
    .popup-body {
        padding-left: 20px;
        padding-right: 20px;
    }
}