/* =============================================
   Autikids - Estilos Globais
   Arquivo: style.css
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue-50:  #EFF6FF;
    --blue-100: #DBEAFE;
    --blue-200: #BFDBFE;
    --blue-400: #60A5FA;
    --blue-500: #3B82F6;
    --blue-600: #2563EB;
    --blue-700: #1D4ED8;
    --blue-800: #1E40AF;
    --white:    #FFFFFF;
    --gray-50:  #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --red-100:  #FEE2E2;
    --red-500:  #EF4444;
    --red-600:  #DC2626;
    --green-100:#DCFCE7;
    --green-500:#22C55E;
    --green-600:#16A34A;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.06);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --sidebar-w: 260px;
    --transition: .2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--blue-600); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--blue-700); }
img { max-width: 100%; display: block; }

/* === LAYOUT COM SIDEBAR === */
.app-wrapper { display: flex; min-height: 100vh; }

/* === SIDEBAR === */
.sidebar {
    width: var(--sidebar-w);
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
    box-shadow: var(--shadow-sm);
}

.sidebar-logo { padding: 28px 24px 20px; border-bottom: 1px solid var(--gray-100); }

.logo-mark { display: flex; align-items: center; gap: 10px; }

.logo-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(59,130,246,.35);
}

.logo-icon svg { width: 20px; height: 20px; fill: white; }

.logo-text { font-size: 1.2rem; font-weight: 800; color: var(--gray-900); letter-spacing: -.5px; }
.logo-text span { color: var(--blue-600); }

.sidebar-user { padding: 16px 24px; border-bottom: 1px solid var(--gray-100); }

.user-info { display: flex; align-items: center; gap: 10px; }

.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--blue-400), var(--blue-600));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: .85rem; flex-shrink: 0;
}

.user-name { font-size: .875rem; font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-label { font-size: .75rem; color: var(--gray-400); }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-section-label {
    font-size: .7rem; font-weight: 700; color: var(--gray-400);
    text-transform: uppercase; letter-spacing: 1px; padding: 8px 12px 6px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--gray-600); font-size: .875rem; font-weight: 500;
    transition: all var(--transition); cursor: pointer;
    border: none; background: none; width: 100%; text-align: left; margin-bottom: 2px;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--blue-50); color: var(--blue-600); }
.nav-item.active { background: var(--blue-50); color: var(--blue-600); font-weight: 600; }
.nav-item.active svg { stroke: var(--blue-600); }

.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--gray-100); }

.btn-logout {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    border-radius: var(--radius-sm); color: var(--gray-500);
    font-size: .875rem; font-weight: 500; width: 100%;
    background: none; border: none; cursor: pointer; transition: all var(--transition);
}
.btn-logout:hover { background: var(--red-100); color: var(--red-600); }
.btn-logout svg { width: 18px; height: 18px; flex-shrink: 0; }

/* === MAIN CONTENT === */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* === TOP BAR === */
.topbar {
    background: var(--white); border-bottom: 1px solid var(--gray-200);
    padding: 0 32px; height: 64px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
}

.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 6px; color: var(--gray-600); }

/* === PAGE CONTENT === */
.page-content { padding: 32px; flex: 1; }

/* === CARDS === */
.card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200); overflow: hidden; }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.card-body { padding: 24px; }

/* === STAT CARDS === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }

.stat-card {
    background: var(--white); border-radius: var(--radius-lg); padding: 24px;
    border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm);
    display: flex; align-items: flex-start; gap: 16px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon.blue { background: var(--blue-50); color: var(--blue-600); }
.stat-icon.green { background: var(--green-100); color: var(--green-600); }
.stat-icon.purple { background: #F3E8FF; color: #9333EA; }
.stat-icon svg { width: 22px; height: 22px; }

.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--gray-900); line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--gray-500); margin-top: 2px; font-weight: 500; }

/* === PROGRESS BAR === */
.progress-wrap { background: var(--gray-200); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--blue-500), var(--blue-400)); transition: width .5s ease; }
.progress-bar.green { background: linear-gradient(90deg, var(--green-500), #4ADE80); }

/* === BUTTONS === */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 99px; font-family: inherit;
    font-size: .875rem; font-weight: 600; border: none; cursor: pointer;
    transition: all var(--transition); white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--blue-500), var(--blue-600)); color: white; box-shadow: 0 4px 12px rgba(59,130,246,.3); }
.btn-primary:hover { background: linear-gradient(135deg, var(--blue-600), var(--blue-700)); box-shadow: 0 6px 16px rgba(59,130,246,.4); transform: translateY(-1px); color: white; }
.btn-outline { background: white; color: var(--gray-700); border: 1.5px solid var(--gray-200); }
.btn-outline:hover { border-color: var(--blue-300); color: var(--blue-600); background: var(--blue-50); }
.btn-danger { background: var(--red-100); color: var(--red-600); border: none; }
.btn-danger:hover { background: var(--red-500); color: white; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn svg { width: 16px; height: 16px; }

/* === ROTINA CARDS === */
.rotinas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.rotina-card {
    background: var(--white); border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm);
    overflow: hidden; transition: transform var(--transition), box-shadow var(--transition);
    display: flex; flex-direction: column;
}
.rotina-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.rotina-card-top { padding: 20px 20px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rotina-badge { width: 44px; height: 44px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.rotina-card-actions { display: flex; gap: 4px; }
.rotina-card-body { padding: 0 20px 16px; flex: 1; }
.rotina-card-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.rotina-card-desc { font-size: .8rem; color: var(--gray-500); line-height: 1.5; }
.rotina-card-footer { padding: 14px 20px; border-top: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rotina-progress-label { font-size: .75rem; color: var(--gray-500); font-weight: 600; white-space: nowrap; }
.rotina-progress-bar { flex: 1; }

/* === TAREFAS === */
.tarefas-list { display: flex; flex-direction: column; gap: 10px; }

.tarefa-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--gray-50); border-radius: var(--radius-md); border: 1px solid var(--gray-200); transition: all var(--transition); }
.tarefa-item.concluida { background: var(--green-100); border-color: #BBF7D0; opacity: .85; }
.tarefa-item.concluida .tarefa-titulo { text-decoration: line-through; color: var(--gray-400); }

.tarefa-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--gray-300); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all var(--transition); background: white; }
.tarefa-check.checked { background: var(--green-500); border-color: var(--green-500); }
.tarefa-check.checked svg { display: block; }
.tarefa-check svg { display: none; width: 12px; height: 12px; stroke: white; stroke-width: 3; }

.tarefa-info { flex: 1; }
.tarefa-titulo { font-size: .875rem; font-weight: 600; color: var(--gray-800); }
.tarefa-desc { font-size: .78rem; color: var(--gray-500); }
.tarefa-order { color: var(--gray-300); font-size: .85rem; font-weight: 700; min-width: 20px; }

/* === FORMULÁRIOS === */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: .875rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-control { width: 100%; padding: 11px 16px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-md); font-family: inherit; font-size: .875rem; color: var(--gray-800); background: var(--white); transition: border-color var(--transition), box-shadow var(--transition); outline: none; }
.form-control:focus { border-color: var(--blue-400); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* === ALERTS === */
.alert { padding: 12px 16px; border-radius: var(--radius-md); font-size: .875rem; font-weight: 500; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.alert-error { background: var(--red-100); color: var(--red-600); border: 1px solid #FECACA; }
.alert-success { background: var(--green-100); color: var(--green-600); border: 1px solid #BBF7D0; }
.alert svg { width: 16px; height: 16px; flex-shrink: 0; }

/* === PAGE HEADER === */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.page-header-title { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); }
.page-header-sub { font-size: .875rem; color: var(--gray-500); margin-top: 2px; }

/* === LOGIN / REGISTER === */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--blue-50) 0%, var(--white) 50%, var(--blue-50) 100%); padding: 24px; }
.auth-card { background: var(--white); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); border: 1px solid var(--gray-200); padding: 48px 44px; width: 100%; max-width: 440px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo-icon { width: 56px; height: 56px; background: linear-gradient(135deg, var(--blue-500), var(--blue-700)); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; box-shadow: 0 6px 20px rgba(59,130,246,.35); }
.auth-logo-icon svg { width: 28px; height: 28px; fill: white; }
.auth-title { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); }
.auth-subtitle { font-size: .875rem; color: var(--gray-500); margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 24px; font-size: .875rem; color: var(--gray-500); }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-state-icon { width: 64px; height: 64px; background: var(--blue-50); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; color: var(--blue-400); }
.empty-state-icon svg { width: 32px; height: 32px; }
.empty-state h3 { font-size: 1.1rem; font-weight: 700; color: var(--gray-800); margin-bottom: 6px; }
.empty-state p { font-size: .875rem; color: var(--gray-500); margin-bottom: 20px; }

/* === BADGE === */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: .72rem; font-weight: 700; }
.badge-blue { background: var(--blue-100); color: var(--blue-700); }
.badge-green { background: var(--green-100); color: var(--green-600); }

/* === MODAL === */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1000; align-items: center; justify-content: center; padding: 24px; }
.modal-overlay.active { display: flex; }
.modal-box { background: var(--white); border-radius: var(--radius-lg); padding: 32px; max-width: 400px; width: 100%; box-shadow: var(--shadow-lg); text-align: center; }
.modal-icon { font-size: 2.5rem; margin-bottom: 12px; }
.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.modal-text { font-size: .875rem; color: var(--gray-500); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* === DIVIDER === */
.divider { height: 1px; background: var(--gray-200); margin: 24px 0; }

/* === SIDEBAR OVERLAY MOBILE === */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    :root { --sidebar-w: 240px; }
    .page-content { padding: 24px; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .main-content { margin-left: 0; }
    .hamburger { display: flex; align-items: center; justify-content: center; }
    .page-content { padding: 20px 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .rotinas-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .auth-card { padding: 36px 24px; }
    .topbar { padding: 0 16px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}