:root {
    --primary: #4CAF50;
    --primary-hover: #45a049;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --error: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }

body {
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    padding: 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 420px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.screen { display: none; animation: fadeIn 0.5s ease; }
.screen.active { display: block; }

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

input, select {
    width: 100%;
    padding: 14px;
    margin-bottom: 16px;
    border-radius: 12px;
    border: 1px solid #334155;
    background: #1e293b;
    color: white;
    font-size: 1rem;
    outline: none;
}

button {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    margin-bottom: 12px;
}

button.outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }

/* Header e Abas */
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid #334155; padding-bottom: 10px; }
.logout-btn { width: auto; background: #334155; padding: 8px 15px; font-size: 0.8rem; margin: 0; }

.tabs { display: flex; gap: 10px; margin-bottom: 20px; }
.tab-btn { background: #334155; color: #94a3b8; padding: 10px; font-size: 0.9rem; margin: 0; }
.tab-btn.active { background: var(--primary); color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Dashboard */
.countdown-box {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 30px;
    border-radius: 20px;
    margin: 20px 0;
}

#time-remaining {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to right, #4CAF50, #81C784);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.inputs { display: flex; gap: 10px; }

/* Modal e Ajuda */
.help-circle {
    color: white;
    width: 26px !important; height: 26px !important;
    border-radius: 50% !important;
    padding: 0 !important; margin: 0 !important;
    display: inline-flex; align-items: center; justify-content: center;
    background: #dd1212 !important; font-size: 0.9rem !important;
}

.modal {
    display: none; position: fixed; z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
}
.modal-content {
    background: #1e293b; padding: 30px; border-radius: 20px;
    max-width: 350px; text-align: left; border: 1px solid var(--primary);
}
.modal-content p { font-size: 0.9rem; line-height: 1.6; color: #cbd5e1; white-space: pre-line; margin-top: 10px; }

.chart-container { background: #1e293b; padding: 10px; border-radius: 15px; margin-top: 15px; min-height: 220px; }

#tab-stats[data-period="month"] .chart-container {
    overflow-x: auto;
    min-height: 240px;
}

/* Stats Navbar */
.stats-navbar {
    display: flex;
    gap: 6px;
    margin-bottom: 15px;
    background: #0f172a;
    padding: 4px;
    border-radius: 12px;
}

.stats-nav-btn {
    flex: 1;
    padding: 10px 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 8px;
    margin: 0;
    transition: all 0.3s ease;
}

.stats-nav-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.stats-period-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.period-label {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 600;
}

.period-avg {
    font-size: 0.8rem;
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.15);
    padding: 4px 10px;
    border-radius: 20px;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.summary-item {
    background: #1e293b;
    padding: 12px 8px;
    border-radius: 12px;
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 4px;
}

.summary-value {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: #f8fafc;
}

/* Chart sizes */
#tab-stats #studyChart {
    max-height: 200px;
}

#tab-stats[data-period="month"] #studyChart,
#tab-stats[data-period="quarter"] #studyChart,
#tab-stats[data-period="year"] #studyChart {
    max-height: 200px;
}