/* ==========================================================================
   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) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100%;
        box-shadow: 2px 0 10px rgba(0,0,0,0.5);
        z-index: 100;
        transition: transform 0.3s ease;
    }
    .sidebar.open { transform: translateX(260px); }
    .mobile-toggle { display: block; }
    .top-bar { padding: 0 15px; }
    .content-area { padding: 15px; }
    .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; }
}

@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; }
}