/* 
 * STYLE.CSS - GuiadeBolso Modern Design System 
 * Palette: Red (#E31C25), White (#FFFFFF), Grey (#F5F5F7)
 */

:root {
    --brand-red: #E31C25;
    --brand-dark: #B3141B;
    --bg-light: #F8F9FA;
    --white: #FFFFFF;
    --text-main: #2D3436;
    --text-muted: #636E72;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(227, 28, 37, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --card-bg: #FFFFFF;
    --nav-bg: #FFFFFF;
    --border-color: rgba(0, 0, 0, 0.05);
    --always-white: #FFFFFF;
    --always-black: #000000;
    --alert-bg: #FFF9C4;
    --alert-border: #FBC02D;
    --alert-text: #5D4037;
    --info-bg-red: #FFFBFC;
    --info-border-red: #FFEBEE;
    --info-bg-blue: #F0F7FF;
    --info-border-blue: #007bff;
}

[data-theme="dark"] {
    --bg-light: #121212;
    --white: #1E1E1E;
    --card-bg: #1E1E1E;
    --nav-bg: #1E1E1E;
    --text-main: #F5F5F7;
    --text-muted: #A1A1A6;
    --border-color: rgba(255, 255, 255, 0.1);
    --table-stripe: #262626;
    --badge-bg: #3D0A0C;
    --badge-text: #FF6B6B;
    --alert-bg: #2C2401;
    --alert-border: #FFC107;
    --alert-text: #FFECB3;
    --info-bg-red: #2D0E0E;
    --info-border-red: #B3141B;
    --info-bg-blue: #001f3f;
    --info-border-blue: #0056b3;
    --text-header: #FFFFFF;
}

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* === Layout === */
main {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
    min-height: calc(100vh - 60px);
    width: 100%;
}

/* === Header === */
.app-header {
    background-color: var(--brand-red);
    color: var(--always-white);
    height: calc(60px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-container {
    width: 100%;
    padding: 0 1rem;
    display: flex;
    align-items: center;
}

.logo {
    color: var(--white);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.25rem;
    margin-left: 0.75rem;
    letter-spacing: -0.5px;
}

.icon-btn {
    background: none;
    border: none;
    color: currentColor;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

/* === Side Nav (O Menu que Encolhe/Desliza) === */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.nav-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.side-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--nav-bg);
    z-index: 2001;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 25px rgba(0, 0, 0, 0.1);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.side-nav.open {
    transform: translateX(0);
}

.nav-header {
    padding: 1.5rem;
    background: var(--brand-red);
    color: var(--always-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
}

.nav-list {
    list-style: none;
    padding: 1rem 0;
    overflow-y: auto;
    flex: 1;
}

.nav-list li a {
    display: block;
    padding: 0.85rem 1.5rem;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.nav-list li a:active,
.nav-list li a.active {
    background: rgba(227, 28, 37, 0.1);
    color: var(--brand-red);
    border-left-color: var(--brand-red);
}

.nav-divider {
    height: 1px;
    background: #EEE;
    margin: 1rem 0;
}

.nav-footer {
    padding: 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid #EEE;
}

/* === Content Cards === */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    width: 100%;
}

.alert-box {
    background: var(--alert-bg);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--alert-border);
    margin-bottom: 1.5rem;
    color: var(--alert-text);
}

.alert-box p {
    margin-bottom: 0;
    font-size: 0.9rem;
    color: inherit;
}

.info-box-red {
    background: var(--info-bg-red);
    border: 1px solid var(--info-border-red);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.info-box-red h4 {
    color: var(--brand-red);
    margin-bottom: 0.5rem;
}

.info-box-blue {
    background: var(--info-bg-blue);
    border-left: 5px solid var(--info-border-blue);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.info-box-red-border {
    background: var(--info-bg-red);
    border-left: 5px solid var(--brand-red);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.info-box-simple {
    background: var(--info-bg-red);
    border: 1px solid var(--info-border-red);
    border-radius: 12px;
    padding: 0.75rem;
    text-align: center;
    flex: 1;
}

.card-title {
    color: var(--brand-red);
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h4 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

h3 {
    color: var(--brand-red);
    margin: 1.5rem 0 0.75rem;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
}

[data-theme="dark"] h3 {
    color: #FF6B6B; /* Um vermelho mais suave/brilhante para o modo escuro */
}

h3::before {
    content: '';
    width: 4px;
    height: 1.25rem;
    background: currentColor;
    margin-right: 0.75rem;
    border-radius: 2px;
}

p {
    margin-bottom: 1rem;
    color: var(--text-main);
}

ul,
ol {
    margin-bottom: 1rem;
    padding-left: 1.25rem;
}

li {
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

strong, b {
    color: inherit;
    font-weight: 700;
}

/* === Tables === */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #EEE;
    margin: 1rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--brand-red);
    color: var(--always-white);
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #F0F0F0;
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:nth-child(even) {
    background: var(--table-stripe, #FAFAFA);
}

/* === Components (Search) === */
.search-form {
    display: flex;
    background: var(--white);
    padding: 4px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin: 2rem 0;
}

.search-form input {
    flex: 1;
    border: none;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    outline: none;
    background: transparent;
}

.search-form button {
    background: var(--brand-red);
    color: var(--always-white);
    border: none;
    padding: 0 1.5rem;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

/* === Footer === */
.main-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === Page Navigation === */
.page-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 2rem 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-main);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.nav-btn:active {
    background: rgba(227, 28, 37, 0.05);
    transform: translateY(2px);
}

.nav-btn .nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-btn .nav-title {
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-btn.prev {
    align-items: flex-start;
    text-align: left;
}

.nav-btn.next {
    align-items: flex-end;
    text-align: right;
    background: var(--info-bg-red);
    border-color: var(--info-border-red);
}

.nav-btn.next .nav-label {
    color: var(--brand-red);
}

/* === Utils === */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 2rem;
}

.btn-primary {
    display: inline-block;
    background: var(--brand-red);
    color: var(--always-white);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* === Images === */
img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1rem 0;
}

/* === Ads === */
.ad-banner-app {
    margin: 1.5rem 0;
    padding: 10px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
}

.ad-banner-app small {
    display: block;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.ad-placeholder {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--brand-red);
    border: 2px dashed var(--brand-red);
    border-radius: 8px;
}

/* Responsive adjustments */
@media print {
    .page-nav {
        display: none !important;
    }
}

@media (max-width: 600px) {
    main {
        padding: 0.75rem;
    }

    .card {
        padding: 1rem;
        border-radius: 12px;
    }

    .card-title {
        font-size: 1.4rem;
    }

    h1.card-title {
        font-size: 1.6rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    td,
    th {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .page-nav {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .nav-btn {
        width: 100%;
        align-items: center !important;
        text-align: center !important;
    }
}

@media (max-width: 360px) {
    .logo {
        font-size: 1.1rem;
    }

    .card-title {
        font-size: 1.2rem;
    }
}

/* --- MASCOTE ANIMADO --- */
#mascote-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#mascote-img {
    width: 100px;
    height: 100px;
    cursor: pointer;
    transform-origin: bottom center;
    background-color: transparent;
}

.mascote-balao {
    background: white;
    color: #333;
    padding: 12px 15px;
    border-radius: 15px;
    border-bottom-right-radius: 0;
    width: 180px;
    text-align: center;
    position: relative;
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    /* Default fade-in but controlled per element */
    animation: fadeInBalao 0.3s ease forwards;
    opacity: 0;
}

.mascote-balao:hover {
    box-shadow: 0 8px 25px rgba(227, 28, 37, 0.3);
}

[data-theme="dark"] .mascote-balao {
    background: #2D3436;
    color: #F5F5F7;
    border: 1px solid #555;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .mascote-balao::after {
    border-color: #2D3436 transparent transparent transparent;
}

#baloes-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 20px;
    transform-origin: bottom right;
}

#baloes-wrapper.hidden {
    display: none;
}

.balao-arco-1 {
    transform: translateX(-40px);
    animation-delay: 0s;
}

.balao-arco-2 {
    transform: translateX(-20px);
    animation-delay: 0.1s;
}

.balao-arco-3 {
    transform: translateX(0px);
    animation-delay: 0.2s;
}

.mascote-balao::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px;
    border-width: 10px 10px 0 0;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

@keyframes fadeInBalao {
    from {
        opacity: 0;
        transform: translateY(10px) translateX(var(--translate-x, 0)) scale(0.9);
    }

    to {
        opacity: 1;
        /* Removendo transforms excessivos para não bugar o arco */
    }
}

.mascote-btn {
    background: var(--brand-red);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    margin-top: 8px;
    display: inline-block;
    font-weight: 800;
    text-transform: uppercase;
}
