/* =========================================================
   AgendaPro — Sistema de Agendamento
   Design: Moderno / Profissional / Responsivo
   Font: Plus Jakarta Sans
   ========================================================= */

:root {
    --cor-primaria: #6366f1;
    --cor-primaria-dark: #4f46e5;
    --cor-primaria-light: #eef2ff;
    --sidebar-bg: #0f172a;
    --sidebar-width: 250px;
    --topbar-h: 64px;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --transition: .2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    min-height: 72px;
}

.sidebar-icon-brand {
    width: 38px; height: 38px;
    background: var(--cor-primaria);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-logo { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; }

.brand-name {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 155px;
}

.brand-sub {
    display: block;
    font-size: 10px;
    color: rgba(255,255,255,.4);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,.25);
    padding: 12px 20px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,.6);
    text-decoration: none;
    transition: all var(--transition);
    border-radius: 0;
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active {
    color: #fff;
    background: rgba(255,255,255,.1);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 3px;
    background: var(--cor-primaria);
    border-radius: 0 3px 3px 0;
}

.sidebar-bottom { margin-top: auto; border-top: 1px solid rgba(255,255,255,.07); padding-top: 8px; }
.nav-logout:hover { color: #f87171 !important; }

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
}

/* ===== TOPBAR ===== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition);
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    z-index: 100;
}

.btn-toggle-sidebar {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: none;
}
.btn-toggle-sidebar:hover { background: var(--bg); color: var(--text); }

.topbar-title h1 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-date {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text-muted);
}

.user-avatar {
    width: 34px; height: 34px;
    background: var(--cor-primaria);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}

.user-name { font-size: 13px; font-weight: 600; color: var(--text); }

/* ===== FLASH ===== */
.flash-container { padding: 12px 24px 0; }
.flash-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
    position: relative;
    animation: slideDown .3s ease;
}
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.flash-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.flash-close {
    background: none; border: none;
    cursor: pointer; font-size: 18px;
    margin-left: auto; opacity: .6;
    line-height: 1;
    padding: 0 4px;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== PAGE CONTENT ===== */
.page-content { padding: 24px; flex: 1; }

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header-custom h5 {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== DASHBOARD STATS ===== */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition);
    box-shadow: var(--shadow);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon-primary { background: var(--cor-primaria-light); color: var(--cor-primaria); }
.stat-icon-success { background: #ecfdf5; color: #10b981; }
.stat-icon-warning { background: #fffbeb; color: #f59e0b; }
.stat-icon-danger  { background: #fef2f2; color: #ef4444; }
.stat-icon-blue    { background: #eff6ff; color: #3b82f6; }
.stat-icon-rose    { background: #fff1f2; color: #f43f5e; }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ===== BADGES STATUS ===== */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
}
.badge-agendado   { background: #eef2ff; color: #4f46e5; }
.badge-confirmado { background: #ecfdf5; color: #059669; }
.badge-concluido  { background: #eff6ff; color: #2563eb; }
.badge-cancelado  { background: #fef2f2; color: #dc2626; }
.badge-faltou     { background: #fffbeb; color: #d97706; }

/* ===== TABELAS ===== */
.table-custom { width: 100%; border-collapse: collapse; }
.table-custom th {
    background: var(--bg);
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table-custom td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 13.5px;
}
.table-custom tr:last-child td { border-bottom: none; }
.table-custom tr:hover td { background: #fafbfc; }
.table-custom .actions { display: flex; gap: 6px; }

/* ===== BOTÕES ===== */
.btn-primary {
    background: var(--cor-primaria);
    border-color: var(--cor-primaria);
    font-weight: 600;
    font-size: 13px;
}
.btn-primary:hover {
    background: var(--cor-primaria-dark);
    border-color: var(--cor-primaria-dark);
}

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }

/* ===== FORMS ===== */
.form-label { font-weight: 600; font-size: 13px; color: var(--text); margin-bottom: 5px; }
.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    padding: 8px 12px;
    transition: border-color var(--transition);
    font-family: inherit;
}
.form-control:focus, .form-select:focus {
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--cor-primaria) 15%, transparent);
}

/* ===== SEARCH BAR ===== */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}
.search-box i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 14px;
}
.search-box input {
    padding-left: 36px;
    min-width: 220px;
}

/* ===== AGENDA VISUAL ===== */
.agenda-grid {
    display: grid;
    gap: 12px;
}

.agenda-hora-slot {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.hora-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    width: 48px;
    flex-shrink: 0;
    padding-top: 8px;
    font-family: 'JetBrains Mono', monospace;
}

.slot-area {
    flex: 1;
    min-height: 44px;
    border: 1.5px dashed transparent;
    border-radius: 8px;
    transition: border-color .15s;
}
.slot-area:hover { border-color: var(--border); }
.slot-area.has-items { border-color: transparent; }

.agenda-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 10px 14px;
    border-left: 4px solid var(--cor-primaria);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all .15s;
    position: relative;
}
.agenda-card:hover { transform: translateX(3px); box-shadow: var(--shadow-md); }
.agenda-card.status-agendado   { border-left-color: #6366f1; }
.agenda-card.status-confirmado { border-left-color: #10b981; }
.agenda-card.status-concluido  { border-left-color: #3b82f6; }
.agenda-card.status-cancelado  { border-left-color: #ef4444; opacity: .65; }
.agenda-card.status-faltou     { border-left-color: #f59e0b; opacity: .65; }
.agenda-card.passado           { opacity: .55; }

.agenda-card-cliente { font-weight: 700; font-size: 13.5px; }
.agenda-card-info    { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.agenda-card-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.agenda-card-actions .btn { font-size: 11px; padding: 3px 8px; }

/* Linha divisória de hora atual */
.current-time-line {
    height: 2px;
    background: #ef4444;
    border-radius: 1px;
    position: relative;
    margin: 4px 0;
}
.current-time-line::before {
    content: '';
    position: absolute;
    left: -4px; top: -4px;
    width: 10px; height: 10px;
    background: #ef4444;
    border-radius: 50%;
}

/* ===== PAGINAÇÃO ===== */
.pagination .page-link {
    color: var(--cor-primaria);
    border-color: var(--border);
    font-size: 13px;
    padding: 6px 12px;
}
.pagination .page-item.active .page-link {
    background: var(--cor-primaria);
    border-color: var(--cor-primaria);
}

/* ===== WEEK NAV ===== */
.week-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
}
.week-nav .day-btn {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s;
    border: 1.5px solid transparent;
    font-size: 12px;
}
.week-nav .day-btn:hover { background: var(--bg); }
.week-nav .day-btn.active {
    background: var(--cor-primaria);
    color: white;
    font-weight: 700;
}
.week-nav .day-btn.today { border-color: var(--cor-primaria); }
.week-nav .day-name { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.week-nav .day-num { font-size: 18px; font-weight: 800; line-height: 1.1; }

/* ===== RELATÓRIOS ===== */
.relatorio-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.bar-chart-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.bar-chart-label { width: 130px; font-size: 12.5px; font-weight: 600; flex-shrink: 0; }
.bar-chart-bar-wrap { flex: 1; background: var(--bg); border-radius: 4px; height: 22px; overflow: hidden; }
.bar-chart-bar {
    height: 100%;
    background: var(--cor-primaria);
    border-radius: 4px;
    transition: width .8s ease;
    display: flex; align-items: center;
    padding: 0 8px;
    font-size: 11px; font-weight: 700; color: white;
    min-width: 30px;
}
.bar-chart-val { font-size: 12.5px; font-weight: 700; width: 60px; text-align: right; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: rgba(255,255,255,.97);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0,0,0,.4);
}

.login-logo {
    width: 52px; height: 52px;
    background: var(--cor-primaria);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: white;
    margin: 0 auto 16px;
}

.login-title { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }

/* ===== MODAL FIXES ===== */
.modal-header { border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-footer { border-top: 1px solid var(--border); }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; opacity: .35; }
.empty-state p { font-size: 14px; }

/* ===== TAGS ===== */
.tag-ativo   { background: #ecfdf5; color: #059669; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.tag-inativo { background: #f1f5f9; color: #64748b; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.show { display: block; }
    .main-wrapper { margin-left: 0 !important; }
    .btn-toggle-sidebar { display: flex !important; }
    .page-content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }
    .table-responsive { overflow-x: auto; }
    .week-nav .day-btn { padding: 6px 2px; }
    .week-nav .day-num { font-size: 14px; }
}

@media (max-width: 480px) {
    .search-box input { min-width: 160px; }
    .card-header-custom { flex-wrap: wrap; gap: 10px; }
}
