/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #F9F8F6;
    color: #333F38;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
    padding-bottom: 3rem;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Alinha os botões pelo topo do texto */
    margin-bottom: 2rem;
    gap: 2rem; /* Garante que o texto não colou nos botões em telas menores */
}

.apresentacao {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Espaço entre o título h1 e o parágrafo */
}

.app-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 300;
    color: #333F38;
    letter-spacing: -0.02em;
    margin: 0; /* Remove margens padrões do h1 */
}

.app-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #6E7A73; /* Tom de cinza agradável para leitura */
    margin: 0; /* Remove margens padrões do p */
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0; /* Impede que os botões esmaguem ou diminuam de tamanho */
    margin-top: 0.25rem; /* Ajuste fino para alinhar visualmente com o primeiro h1 */
}

.icon-btn {
    background: white;
    border: 1px solid #E8E6E1;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    color: #6E7A73;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: #F9F8F6;
    transform: rotate(15deg);
}

.settings-btn:hover {
    transform: rotate(45deg);
}

/* Welcome Modal */
.welcome-content {
    max-width: 600px;
    text-align: center;
}

.welcome-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 300;
    color: #333F38;
    margin-bottom: 1rem;
}

.welcome-description {
    color: #6E7A73;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

/* Addiction Banner */
.addiction-banner {
    background: linear-gradient(135deg, rgba(139, 168, 136, 0.1) 0%, rgba(139, 168, 136, 0.05) 100%);
    border: 2px solid #8BA888;
    border-radius: 1.5rem;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: #333F38;
}

.banner-content i {
    font-size: 1.5rem;
    color: #8BA888;
}

.banner-change {
    background: white;
    border: 1px solid #E8E6E1;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6E7A73;
    transition: all 0.3s ease;
}

.banner-change:hover {
    background: #8BA888;
    color: white;
}

/* Hero Section */
.hero-section {
    margin-bottom: 2rem;
}

.counter-card {
    background: white;
    border-radius: 2rem;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(51, 63, 56, 0.04);
    border: 1px solid rgba(232, 230, 225, 0.5);
    margin-bottom: 1.5rem;
}

.counter-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #6E7A73;
    margin-bottom: 1rem;
}

.counter-value {
    font-family: 'Outfit', sans-serif;
    font-size: 5rem;
    font-weight: 300;
    color: #8BA888;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.counter-subtitle {
    font-size: 1rem;
    color: #6E7A73;
    font-weight: 500;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-item {
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: 0 4px 16px rgba(51, 63, 56, 0.03);
    border: 1px solid rgba(232, 230, 225, 0.5);
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 500;
    color: #333F38;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: #6E7A73;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Quote Section */
.quote-section {
    background: linear-gradient(135deg, #8BA888 0%, #769373 100%);
    border-radius: 2rem;
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.quote-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    z-index: 0;
}

.quote-icon {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 1rem;
    display: block;
}

.quote-text {
    font-size: 1.1rem;
    color: white;
    line-height: 1.8;
    position: relative;
    z-index: 1;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

/* Tip Section */
.tip-section {
    background: linear-gradient(135deg, rgba(217, 138, 127, 0.1) 0%, rgba(217, 138, 127, 0.05) 100%);
    border-radius: 2rem;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(217, 138, 127, 0.2);
}

.tip-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.tip-header i {
    font-size: 1.75rem;
    color: #D98A7F;
}

.tip-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 500;
    color: #333F38;
}

.tip-text {
    color: #333F38;
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.btn-link {
    background: none;
    border: none;
    color: #D98A7F;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.btn-link:hover {
    gap: 0.75rem;
}

/* Action Section */
.action-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    border: none;
    border-radius: 2rem;
    padding: 1rem 1.5rem;
    font-family: 'Manrope', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn i {
    font-size: 1.25rem;
}

.btn-primary {
    background: #8BA888;
    color: white;
}

.btn-primary:hover {
    background: #769373;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 168, 136, 0.3);
}

.btn-secondary {
    background: white;
    color: #D98A7F;
    border: 2px solid #D98A7F;
}

.btn-secondary:hover {
    background: #D98A7F;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(217, 138, 127, 0.3);
}

.btn-small {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    margin-top: 1rem;
    background: #8BA888;
    color: white;
}

.btn-small:hover {
    background: #769373;
}

.btn-large {
    padding: 1.25rem 2rem;
    font-size: 1.05rem;
    width: 100%;
    margin-top: 1rem;
}

.btn-danger {
    background: #D98A7F;
    color: white;
    width: 100%;
}

.btn-danger:hover {
    background: #c67166;
}

/* Journal Section */
.journal-section,
.calendar-section,
.history-section {
    margin-bottom: 2rem;
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 400;
    color: #333F38;
    margin-bottom: 1rem;
}

.journal-card {
    background: white;
    border-radius: 2rem;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(51, 63, 56, 0.04);
    border: 1px solid rgba(232, 230, 225, 0.5);
}

#journalInput {
    width: 100%;
    border: 2px solid #E8E6E1;
    border-radius: 1.5rem;
    padding: 1rem;
    font-family: 'Manrope', sans-serif;
    font-size: 0.95rem;
    color: #333F38;
    background: #F9F8F6;
    resize: vertical;
    transition: all 0.3s ease;
}

#journalInput:focus {
    outline: none;
    border-color: #8BA888;
    background: white;
    box-shadow: 0 0 0 4px rgba(139, 168, 136, 0.1);
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
    touch-action: pan-y;
}

.calendar-day {
    aspect-ratio: 1;
    border: none;
    font-family: inherit;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    font-size: 0.75rem;
    font-weight: 600;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.calendar-day:hover {
    transform: scale(1.1);
}

.day-clean {
    background: #8BA888;
    color: white;
}

.day-stumble {
    background: #D98A7F;
    color: white;
}

.day-empty {
    background: #E8E6E1;
    color: #6E7A73;
}

.calendar-legend {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-clean {
    background: #8BA888;
}

.legend-stumble {
    background: #D98A7F;
}

.legend-empty {
    background: #E8E6E1;
}

.legend-text {
    font-size: 0.875rem;
    color: #6E7A73;
}

/* History List */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(51, 63, 56, 0.03);
    border: 1px solid rgba(232, 230, 225, 0.5);
}

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

.history-date {
    font-weight: 600;
    color: #333F38;
}

.history-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-clean {
    background: rgba(139, 168, 136, 0.15);
    color: #8BA888;
}

.badge-stumble {
    background: rgba(217, 138, 127, 0.15);
    color: #D98A7F;
}

.history-content {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: #6E7A73;
    font-size: 0.95rem;
    line-height: 1.6;
}

.history-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #6E7A73;
}

/* Tips Content */
.tips-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tip-category {
    background: #F9F8F6;
    border-radius: 1.5rem;
    padding: 1.5rem;
    border: 1px solid #E8E6E1;
}

.tip-category h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    color: #333F38;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tip-category h3 i {
    color: #8BA888;
}

.tip-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tip-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.tip-item i {
    color: #8BA888;
    font-size: 1.25rem;
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.tip-item p {
    color: #6E7A73;
    line-height: 1.6;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(51, 63, 56, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 2rem;
    padding: 2.5rem;
    max-width: 500px;
    width: 100%;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(51, 63, 56, 0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 700px;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: #F9F8F6;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    color: #6E7A73;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background: #E8E6E1;
    transform: rotate(90deg);
}

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 400;
    color: #333F38;
    margin-bottom: 0.5rem;
}

.modal-description {
    color: #6E7A73;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.modal-celebration {
    text-align: center;
}

.celebration-icon {
    font-size: 4rem;
    color: #8BA888;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #333F38;
    margin-bottom: 0.5rem;
}

.form-select,
.form-input,
.form-group textarea {
    width: 100%;
    border: 2px solid #E8E6E1;
    border-radius: 1rem;
    padding: 0.875rem 1rem;
    font-family: 'Manrope', sans-serif;
    font-size: 0.95rem;
    color: #333F38;
    background: #F9F8F6;
    transition: all 0.3s ease;
}

.form-select:focus,
.form-input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #8BA888;
    background: white;
    box-shadow: 0 0 0 4px rgba(139, 168, 136, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.settings-section {
    padding-top: 1rem;
    margin-bottom: 2rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-subtitle {
    font-size: 1rem;
    font-weight: 600;
    color: #333F38;
    margin-bottom: 1rem;
}

.settings-info {
    background: #F9F8F6;
    padding: 1rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
    color: #333F38;
    font-weight: 500;
}

.settings-warning {
    text-align: center;
    color: #D98A7F;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333F38;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 12px 40px rgba(51, 63, 56, 0.3);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-message {
    font-weight: 500;
}

/* Responsive */
@media (max-width: 640px) {
    .header{
    flex-direction: column-reverse;
    }
    .app-container {
        padding: 1rem;
    }

    .app-title {
        font-size: 1.5rem;
    }

    .counter-value {
        font-size: 4rem;
    }

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

    .action-section {
        grid-template-columns: 1fr;
    }

    .calendar-grid,
    .calendar-weekdays {
        gap: 0.35rem;
    }

    .modal-content {
        padding: 2rem 1.5rem;
    }

    .welcome-title {
        font-size: 2rem;
    }
}

@media (max-width: 400px) {
    .counter-value {
        font-size: 3rem;
    }

    .calendar-grid,
    .calendar-weekdays {
        gap: 0.25rem;
    }

    .calendar-day {
        font-size: 0.7rem;
    }
}


/* ---------- Acessibilidade e foco ---------- */
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid #5E7F5B;
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

/* ---------- Calendário ---------- */
.day-mark {
    font-size: 0.6rem;
    font-weight: 700;
}

.calendar-day.day-disabled {
    opacity: 0.4;
    cursor: default;
}

.calendar-day.day-disabled:hover {
    transform: none;
}

/* ---------- Dicas (antes usavam variáveis CSS que não existiam) ---------- */
.tips-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tip-card {
    background-color: white;
    padding: 1.25rem;
    border-radius: 12px;
    border-left: 4px solid #8BA888;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 4px 16px rgba(51, 63, 56, 0.05);
}

.tip-card i {
    color: #8BA888;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.tip-card p {
    margin: 0;
    color: #333F38;
    line-height: 1.5;
}

/* ---------- Caixa de ajuda ---------- */
.help-box {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: #F1F4EF;
    border: 1px solid #DDE5D9;
    border-radius: 12px;
    font-size: 0.9rem;
    color: #333F38;
}

.help-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-box ul {
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.help-note {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: #6E7A73;
}

/* ---------- Histórico, privacidade, modais e configurações ---------- */
.btn-delete-entry {
    background: none;
    border: none;
    color: #B94A3E;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    font-size: 1.2rem;
}

.privacy-eye-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    font-size: 1.2rem;
}

.modal-small {
    max-width: 400px;
    text-align: center;
}

.day-edit-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.settings-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

/* ---------- Calendário mensal ---------- */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.calendar-nav-center {
    text-align: center;
    flex: 1;
}

.calendar-month {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 500;
    color: #333F38;
}

.calendar-summary {
    font-size: 0.8rem;
    color: #6E7A73;
}

.calendar-nav-btn {
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid #E8E6E1;
    background: white;
    color: #333F38;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.calendar-nav-btn:hover:not(:disabled) {
    background: #F1F4EF;
    transform: scale(1.05);
}

.calendar-nav-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6E7A73;
}

.calendar-blank {
    aspect-ratio: 1;
}

.calendar-day.day-today {
    outline: 2px solid #333F38;
    outline-offset: 2px;
}

.calendar-today-btn {
    display: block;
    margin: 0 auto 1rem;
}
