/* ==========================================================================
   MODAL & SYNC UI
   ========================================================================== */
.auth-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}
.auth-modal.open { display: flex; }

.auth-card {
    width: min(400px, 95vw);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    position: relative;
}

.sync-status {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(255,255,255,0.05);
    transition: all 0.2s;
}
.sync-status:hover { background: rgba(255,255,255,0.1); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.offline { background: var(--text-muted); box-shadow: 0 0 5px var(--text-muted); }
.status-dot.syncing { background: var(--warning); box-shadow: 0 0 5px var(--warning); animation: pulse 1.5s infinite; }
.status-dot.online { background: var(--success); box-shadow: 0 0 5px var(--success); }

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.close-modal {
    position: absolute; top: 15px; right: 15px;
    background: none; border: none; color: var(--text-muted);
    font-size: 1.2rem; cursor: pointer;
}

.last-sync-label {
    position: absolute;
    bottom: 5px;
    right: 15px;
    font-size: 0.6rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Mobile */
@media (max-width: 768px) {
    .mobile-toggle { display: block; }
    .grid-4, .grid-2 { grid-template-columns: 1fr !important; }
    .grid-chart { grid-template-columns: 1fr !important; }
    .chart-wrapper { height: 220px; }
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    td, th { padding: 10px 12px; font-size: 0.8rem; }
    .auth-card { width: 95vw; max-width: 400px; padding: 20px; margin: 10px; }
    .calendar-day { min-height: 32px; max-height: 42px; font-size: 0.7rem; }
    .calendar-weekday { font-size: 0.65rem; padding: 5px 0; }
    .emotion-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .account-grid { grid-template-columns: repeat(3, 1fr) !important; }
    .stat-card .value { font-size: 1.3rem; }
    .card { padding: 16px; }
    #syncText { display: none !important; }

    #header-account-name {
        max-width: 72px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        vertical-align: middle;
        font-size: 0.65rem;
        padding: 3px 7px;
    }
}

@media (max-width: 480px) {
    .top-bar { padding: 0 10px; height: 52px; }
    .page-title { font-size: 0.95rem; }
    .content-area { padding: 10px; }
    .card { padding: 12px; border-radius: 8px; }
    .stat-card .value { font-size: 1.1rem; }
    .stat-card .label { font-size: 0.65rem; }
    .chart-wrapper { height: 180px; }
    .calendar-day { min-height: 28px; max-height: 35px; font-size: 0.65rem; border-radius: 3px; }
    .calendar-weekday { font-size: 0.6rem; padding: 4px 0; }
    .calendar-grid { gap: 3px; }
    .btn { padding: 10px 16px; font-size: 0.85rem; }
    .hide-mobile { display: none !important; }
    .emotion-btn { padding: 8px 5px; font-size: 0.75rem; }
    .account-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .brand span { font-size: 1rem; }

    /* Fix badge em telas muito pequenas */
    #header-account-name {
        max-width: 58px;
        font-size: 0.6rem;
        padding: 2px 6px;
    }
}

/* ── MODAL OVERLAY (Confirm + Criar Conta) ────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    width: min(420px, 92vw);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    animation: fadeIn 0.2s ease;
}
.modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}
.modal-header i { font-size: 1.2rem; color: var(--warning); }
.modal-header h3 { margin: 0; font-size: 1rem; }
.modal-body { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
