/* ============================================================
   BarberFlow — Estilos Principais
   Tema escuro com destaques dourados/âmbar
   Fonte: Poppins (Google Fonts)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- Variáveis CSS ---- */
:root {
    /* Cores principais */
    --bg-primary:     #111318;
    --bg-secondary:   #1a1d24;
    --bg-tertiary:    #22262f;
    --bg-card:        #1e2129;
    --bg-hover:       #252930;

    /* Dourado/âmbar */
    --gold:           #D4AF37;
    --gold-light:     #F0C93A;
    --gold-dark:      #A8882B;
    --gold-alpha:     rgba(212, 175, 55, 0.12);
    --gold-alpha-hover: rgba(212, 175, 55, 0.22);
    --gold-gradient:  linear-gradient(135deg, #B8860B 0%, #F0C93A 55%, #B8860B 100%);
    --gold-glow:      0 4px 24px rgba(212, 175, 55, 0.35);

    /* Texto */
    --text-primary:   #F2EED8;
    --text-secondary: #9A9AB0;
    --text-muted:     #5A5A70;

    /* Bordas */
    --border:         #252830;
    --border-gold:    rgba(212, 175, 55, 0.32);

    /* Status */
    --status-aguardando: #d4a72c;
    --status-confirmado: #4a9eff;
    --status-concluido:  #3ecf72;
    --status-cancelado:  #ef4f5e;

    /* Sidebar */
    --sidebar-width:  260px;
    --sidebar-bg:     #0E1016;

    /* Raios e sombras */
    --radius-sm:      8px;
    --radius-md:      12px;
    --radius-lg:      20px;
    --shadow-card:    0 2px 20px rgba(0,0,0,0.45);
    --shadow-gold:    0 4px 24px rgba(212,175,55,0.28);

    /* Transições */
    --transition:     0.2s ease;
}

/* ---- Reset e base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}
a:focus, button:focus { outline: none; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }

img { max-width: 100%; display: block; }

ul, ol { list-style: none; }

/* ---- Layout com Sidebar ---- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0E1016 0%, #0A0C12 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    height: 100dvh; /* iOS Safari: ajusta dinamicamente com a barra do browser */
    z-index: 100;
    transition: transform var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-logo-img {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-gold);
}

.sidebar-logo-placeholder {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--gold-alpha);
    border: 1px solid var(--border-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--gold);
    flex-shrink: 0;
}

.sidebar-logo-text {
    overflow: hidden;
}

.sidebar-logo-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logo-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.sidebar-section {
    padding: 16px 16px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    margin: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.sidebar-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-item i {
    display: inline-block;
    transition: transform 0.15s ease;
}
.sidebar-item:hover i {
    transform: scale(1.2);
}
.sidebar-item:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
}

.sidebar-item.active {
    background: var(--gold-alpha);
    color: var(--gold);
    font-weight: 600;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--gold);
    border-radius: 0 3px 3px 0;
}

.sidebar-item svg,
.sidebar-item i {
    width: 18px;
    font-size: 16px;
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar-item.active svg,
.sidebar-item.active i {
    opacity: 1;
}

.sidebar-footer {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}

.sidebar-user:hover { background: var(--bg-hover); }

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gold-alpha);
    border: 1px solid var(--border-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--gold);
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    margin-top: 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
    background: none;
    border: none;
}

.sidebar-logout:hover {
    background: rgba(239,79,94,0.1);
    color: #ef4f5e;
}

/* ---- Conteúdo principal ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    padding-top: calc(16px + env(safe-area-inset-top));
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
}

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

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-primary);
}

.page-content {
    padding: 28px;
    flex: 1;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-card);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ---- KPI Cards (dashboard) ---- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: linear-gradient(145deg, var(--bg-card) 0%, #191c24 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
    border-color: var(--border-gold);
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.4), 0 0 0 1px var(--border-gold);
}

.kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--gold-alpha);
    border: 1px solid var(--border-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--gold);
    margin-bottom: 12px;
    box-shadow: 0 0 12px rgba(212,175,55,0.1);
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.kpi-change {
    font-size: 12px;
    margin-top: 8px;
    font-weight: 500;
}

.kpi-change.up   { color: #3ecf72; }
.kpi-change.down { color: #ef4f5e; }

/* ---- Botões ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--gold-gradient);
    background-size: 200% auto;
    color: #0A0C12;
    border: none;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: background-position 0.4s ease, box-shadow var(--transition), transform var(--transition);
}

.btn-primary:hover {
    background-position: right center;
    box-shadow: var(--gold-glow);
    color: #0A0C12;
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-danger {
    background: transparent;
    color: #ef4f5e;
    border-color: rgba(239,79,94,0.3);
}

.btn-danger:hover {
    background: rgba(239,79,94,0.1);
    border-color: #ef4f5e;
}

.btn-success {
    background: transparent;
    color: #3ecf72;
    border-color: rgba(62,207,114,0.3);
}

.btn-success:hover {
    background: rgba(62,207,114,0.1);
    border-color: #3ecf72;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 15px;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Efeito de pressão em todos os botões */
.btn:active:not(:disabled) {
    transform: scale(0.96) !important;
    box-shadow: none !important;
    transition: transform 0.08s ease, box-shadow 0.08s ease !important;
}

/* ---- Formulários ---- */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-label span.required {
    color: var(--gold);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-alpha);
}

/* ---- Input type date - compatibilidade dark theme ---- */
input[type="date"] {
    color-scheme: dark;
    cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
    opacity: 0.7;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

select.form-control option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: #ef4f5e;
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.form-row > * {
    min-width: 0;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--gold);
    cursor: pointer;
}

/* ---- Tabelas ---- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

/* Profissional no mobile card do dashboard — visível só em telas pequenas */
.dash-prof-hint { display: none; }

.dash-appts-wrapper {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.dash-appts-wrapper::-webkit-scrollbar { width: 4px; }
.dash-appts-wrapper::-webkit-scrollbar-track { background: transparent; }
.dash-appts-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.dash-appts-wrapper .table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-tertiary);
}

table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.table thead th {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: left;
}

table.table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
    text-align: left;
}

table.table tbody tr:last-child td { border-bottom: none; }

table.table tbody tr:hover { background: var(--bg-hover); }

/* ---- Status badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.status-aguardando { background: rgba(212,167,44,0.15); color: var(--status-aguardando); }
.status-confirmado { background: rgba(74,158,255,0.15); color: var(--status-confirmado); }
.status-concluido  { background: rgba(62,207,114,0.15); color: var(--status-concluido); }
.status-cancelado  { background: rgba(239,79,94,0.15);  color: var(--status-cancelado); }

/* ---- Avatar ---- */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold-alpha);
    border: 1px solid var(--border-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--gold);
    flex-shrink: 0;
    overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }

/* ---- Alerts / Flash ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(62,207,114,0.1);
    border-color: rgba(62,207,114,0.25);
    color: #3ecf72;
}

.alert-danger {
    background: rgba(239,79,94,0.1);
    border-color: rgba(239,79,94,0.25);
    color: #ef4f5e;
}

.alert-warning {
    background: rgba(212,167,44,0.1);
    border-color: rgba(212,167,44,0.25);
    color: var(--status-aguardando);
}

.alert-info {
    background: rgba(74,158,255,0.1);
    border-color: rgba(74,158,255,0.25);
    color: #4a9eff;
}

/* ---- Modal ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

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

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

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    font-size: 18px;
    transition: color var(--transition);
}

.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 24px; }

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}


/* ---- Modal de confirmação global (bfConfirm) ---- */
#bf-confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
#bf-confirm-overlay.active { display: flex; }

#bf-confirm-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    animation: modalIn 0.2s ease;
    overflow: hidden;
}

#bf-confirm-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 0 auto 16px;
    font-size: 24px;
}
#bf-confirm-icon-wrap.danger  { background: rgba(239,79,94,.15);  color: #ef4f5e; }
#bf-confirm-icon-wrap.warning { background: rgba(212,167,44,.15); color: var(--gold); }
#bf-confirm-icon-wrap.info    { background: rgba(74,158,255,.15); color: #4a9eff; }

#bf-confirm-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
}
#bf-confirm-msg {
    font-size: 13.5px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
}
#bf-confirm-body {
    padding: 28px 24px 20px;
}
#bf-confirm-footer {
    display: flex;
    gap: 10px;
    padding: 0 24px 24px;
    justify-content: center;
}
#bf-confirm-footer .btn { min-width: 110px; justify-content: center; }

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    justify-content: center;
}

.page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.page-btn:hover { border-color: var(--gold); color: var(--gold); }
.page-btn.active { background: var(--gold); border-color: var(--gold); color: #111318; font-weight: 600; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state-text {
    font-size: 13px;
    max-width: 320px;
    margin: 0 auto 20px;
}

/* ---- Divisor ---- */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    gap: 0;
    margin-bottom: 24px;
}

.tab {
    padding: 10px 20px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: 'Inter', sans-serif;
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ---- Splash Screen ---- */
#splash-screen {
    position: fixed;
    inset: 0;
    background: #111318;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}
#splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}
#splash-logo {
    width: 200px;
    max-width: 55vw;
    animation: splash-pulse 1.8s ease-in-out infinite;
    filter: drop-shadow(0 0 24px rgba(212,175,55,0.35));
}
@keyframes splash-pulse {
    0%, 100% { transform: scale(1);    opacity: 1;    filter: drop-shadow(0 0 20px rgba(212,175,55,0.3)); }
    50%       { transform: scale(1.07); opacity: 0.88; filter: drop-shadow(0 0 36px rgba(212,175,55,0.6)); }
}

/* ---- Loader ---- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Banner de Trial / Assinatura
   ============================================================ */
.subscription-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    animation: bfFadeUp 0.3s ease both;
}
.subscription-banner--warning {
    background: linear-gradient(90deg, rgba(212,167,44,0.12), rgba(212,167,44,0.07));
    border-bottom: 1px solid rgba(212,167,44,0.25);
    color: #e0bc5a;
}
.subscription-banner--expired {
    background: linear-gradient(90deg, rgba(239,79,94,0.15), rgba(239,79,94,0.08));
    border-bottom: 1px solid rgba(239,79,94,0.3);
    color: #ef4f5e;
}
.sub-banner-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    flex-wrap: wrap;
}
.sub-banner-inner i { font-size: 15px; flex-shrink: 0; }
.sub-banner-btn {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    background: rgba(212,167,44,0.2);
    color: #e0bc5a;
    border: 1px solid rgba(212,167,44,0.4);
    transition: all 0.15s ease;
    white-space: nowrap;
}
.sub-banner-btn:hover { background: rgba(212,167,44,0.35); }
.sub-banner-btn--urgent {
    background: rgba(239,79,94,0.2);
    color: #ef4f5e;
    border-color: rgba(239,79,94,0.4);
}
.sub-banner-btn--urgent:hover { background: rgba(239,79,94,0.35); }
.sub-banner-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    padding: 4px;
    font-size: 13px;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.sub-banner-close:hover { opacity: 1; }

/* ============================================================
   UX — Transições de página e micro-interações
   ============================================================ */

/* Entrada suave de conteúdo (página carrega / AJAX navega) */
@keyframes bfFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-enter {
    animation: bfFadeUp 0.22s ease both;
}

/* Entrada escalonada para cards, KPIs e linhas */
.stagger-1 { animation: bfFadeUp 0.22s ease 0.03s both; }
.stagger-2 { animation: bfFadeUp 0.22s ease 0.07s both; }
.stagger-3 { animation: bfFadeUp 0.22s ease 0.11s both; }
.stagger-4 { animation: bfFadeUp 0.22s ease 0.15s both; }
.stagger-5 { animation: bfFadeUp 0.22s ease 0.19s both; }
.stagger-6 { animation: bfFadeUp 0.22s ease 0.23s both; }

/* ---- Sidebar overlay (mobile) ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ============================================================
   Tela de Login / Registro (sem sidebar)
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

/* Imagem hero no topo (mobile-first) */
.auth-hero {
    height: 55vh;
    min-height: 280px;
    background-size: cover;
    background-position: center 20%;
    background-repeat: no-repeat;
    flex-shrink: 0;
    position: relative;
}

/* Escurece levemente o topo para dar profundidade */
.auth-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.25) 0%, transparent 60%);
}

/* Card sobe por cima com cantos arredondados — estilo bottom sheet */
.auth-card {
    background: var(--bg-primary);
    border-radius: 28px 28px 0 0;
    padding: 28px 24px 48px;
    width: 100%;
    flex: 1;
    margin-top: -44px;
    position: relative;
    z-index: 1;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.5);
}

/* Desktop: centraliza em card flutuante com imagem como fundo */
@media (min-width: 769px) {
    .auth-page {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        padding: 20px;
    }

    .auth-hero {
        display: none;
    }

    .auth-card {
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: 44px 40px;
        width: 100%;
        max-width: 460px;
        flex: none;
        margin-top: 0;
        box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(212,175,55,0.06);
    }

    /* Brilho de fundo no desktop */
    .auth-page::before {
        content: '';
        position: absolute;
        top: -200px; right: -200px;
        width: 600px; height: 600px;
        background: radial-gradient(circle, rgba(212,175,55,0.06) 0%, transparent 70%);
        pointer-events: none;
    }

    .auth-page::after {
        content: '';
        position: absolute;
        bottom: -200px; left: -200px;
        width: 500px; height: 500px;
        background: radial-gradient(circle, rgba(212,175,55,0.04) 0%, transparent 70%);
        pointer-events: none;
    }
}

.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo-icon {
    width: 56px;
    height: 56px;
    background: var(--gold-alpha);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 12px;
    box-shadow: 0 0 20px rgba(212,175,55,0.15);
}

.auth-logo-img {
    width: 200px;
    max-width: 100%;
    height: auto;
    margin: 0 auto 8px;
    display: block;
    filter: drop-shadow(0 0 16px rgba(212,175,55,0.2));
}

.auth-logo-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.auth-logo-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

.auth-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.auth-link {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 20px;
}

/* ============================================================
   Onboarding (slides de apresentação)
   ============================================================ */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: #0A0C12;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.onboarding-slides {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.onboarding-slide {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 0 0 40px;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}

.onboarding-slide.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.onboarding-slide.exit {
    opacity: 0;
    transform: translateX(-40px);
}

.onboarding-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}

.onboarding-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(10,12,18,0.2) 0%, rgba(10,12,18,0.85) 60%, #0A0C12 100%);
}

.onboarding-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 0 32px;
    max-width: 400px;
}

.onboarding-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: var(--gold-alpha);
    border: 1px solid var(--border-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 20px;
    box-shadow: 0 0 24px rgba(212,175,55,0.2);
}

.onboarding-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.onboarding-desc {
    font-size: 14.5px;
    color: var(--text-secondary);
    line-height: 1.65;
}

.onboarding-footer {
    padding: 20px 28px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.onboarding-dots {
    display: flex;
    gap: 6px;
}

.onboarding-dot {
    width: 6px;
    height: 6px;
    border-radius: 10px;
    background: var(--text-muted);
    transition: all 0.3s ease;
}

.onboarding-dot.active {
    background: var(--gold);
    width: 20px;
    box-shadow: 0 0 8px rgba(212,175,55,0.5);
}

.onboarding-skip {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    cursor: pointer;
    padding: 8px 4px;
    transition: color var(--transition);
}

.onboarding-skip:hover { color: var(--text-secondary); }

.onboarding-next {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gold-gradient);
    background-size: 200% auto;
    color: #0A0C12;
    border: none;
    border-radius: 50px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 24px;
    cursor: pointer;
    transition: background-position 0.4s ease, box-shadow var(--transition), transform var(--transition);
}

.onboarding-next:hover {
    background-position: right center;
    box-shadow: var(--gold-glow);
    transform: translateY(-1px);
}

/* ============================================================
   Página Pública de Agendamento
   ============================================================ */
.public-page {
    min-height: 100vh;
    background: var(--bg-primary);
}

.public-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.public-header > div {
    flex: 1;
    min-width: 0;
}

.public-header-logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-gold);
}

.public-header-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    overflow-wrap: break-word;
    word-break: break-word;
}

.public-header-desc {
    font-size: 13px;
    color: var(--text-muted);
    overflow-wrap: break-word;
    word-break: break-word;
}

@media (max-width: 380px) {
    .public-header {
        padding: 14px 16px;
        gap: 12px;
    }
    .public-header-logo {
        width: 40px;
        height: 40px;
    }
    .public-header-name {
        font-size: 15px;
    }
    .public-header-desc {
        font-size: 12px;
    }
}

.public-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 20px;
}

/* ============================================================
   Calendário / Slots de horário
   ============================================================ */
.slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.slot {
    padding: 8px 4px;
    text-align: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition);
}

.slot:hover   { border-color: var(--gold); color: var(--gold); }
.slot.selected { background: var(--gold); color: #111318; border-color: var(--gold); }
.slot.ocupado { background: var(--bg-tertiary); color: var(--text-muted); cursor: not-allowed; opacity: 0.5; }

/* ============================================================
   Upload de imagem
   ============================================================ */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition);
    background: var(--bg-secondary);
}

.upload-area:hover { border-color: var(--gold); }
.upload-area.dragover { border-color: var(--gold); background: var(--gold-alpha); }

.upload-preview {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-gold);
    margin: 0 auto 8px;
}

/* ============================================================
   Responsividade
   ============================================================ */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .main-content {
        overflow-x: hidden;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    /* Stagger de entrada dos itens do sidebar */
    @keyframes sidebarItemIn {
        from { opacity: 0; transform: translateX(-18px); }
        to   { opacity: 1; transform: translateX(0); }
    }
    .sidebar.open .sidebar-item,
    .sidebar.open .sidebar-section {
        animation: sidebarItemIn 0.3s ease forwards;
        opacity: 0;
    }
    .sidebar.open .sidebar-item:nth-child(1),  .sidebar.open .sidebar-section:nth-child(1)  { animation-delay: 0.04s; }
    .sidebar.open .sidebar-item:nth-child(2),  .sidebar.open .sidebar-section:nth-child(2)  { animation-delay: 0.08s; }
    .sidebar.open .sidebar-item:nth-child(3),  .sidebar.open .sidebar-section:nth-child(3)  { animation-delay: 0.12s; }
    .sidebar.open .sidebar-item:nth-child(4),  .sidebar.open .sidebar-section:nth-child(4)  { animation-delay: 0.16s; }
    .sidebar.open .sidebar-item:nth-child(5),  .sidebar.open .sidebar-section:nth-child(5)  { animation-delay: 0.20s; }
    .sidebar.open .sidebar-item:nth-child(6),  .sidebar.open .sidebar-section:nth-child(6)  { animation-delay: 0.24s; }
    .sidebar.open .sidebar-item:nth-child(7),  .sidebar.open .sidebar-section:nth-child(7)  { animation-delay: 0.28s; }
    .sidebar.open .sidebar-item:nth-child(8),  .sidebar.open .sidebar-section:nth-child(8)  { animation-delay: 0.32s; }
    .sidebar.open .sidebar-item:nth-child(9),  .sidebar.open .sidebar-section:nth-child(9)  { animation-delay: 0.36s; }
    .sidebar.open .sidebar-item:nth-child(10), .sidebar.open .sidebar-section:nth-child(10) { animation-delay: 0.40s; }
    .sidebar.open .sidebar-item:nth-child(11), .sidebar.open .sidebar-section:nth-child(11) { animation-delay: 0.44s; }
    .sidebar.open .sidebar-item:nth-child(12), .sidebar.open .sidebar-section:nth-child(12) { animation-delay: 0.48s; }
    .sidebar.open .sidebar-item:nth-child(n+13), .sidebar.open .sidebar-section:nth-child(n+13) { animation-delay: 0.50s; }

    .hamburger {
        display: flex;
    }

    .pub-link-btn {
        display: none !important;
    }

    .page-content {
        padding: 16px;
    }

    .topbar {
        padding: 12px 16px;
        overflow: hidden;
    }
    /* Topbar: botões de ação viram só ícone para não transbordar */
    .topbar .btn {
        font-size: 0 !important;
        padding: 8px 10px;
        gap: 0;
    }
    .topbar .btn i {
        font-size: 14px !important;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 28px 20px;
    }

    .modal-overlay {
        padding: 12px;
    }

    /* ── Dashboard: gráfico + próximos empilham ── */
    .dash-chart-row {
        grid-template-columns: 1fr !important;
    }
    .dash-chart-row > * {
        min-width: 0;
        overflow: hidden;
    }

    /* ── Dashboard: tabela de agendamentos → cards ── */
    .dash-appts-wrapper {
        overflow-x: visible;
        border: none;
        border-radius: 0;
        background: none;
    }
    .table-dash { display: block !important; }
    .table-dash thead { display: none !important; }
    .table-dash tbody {
        display: flex !important;
        flex-direction: column;
        gap: 8px;
    }
    .table-dash tr {
        display: grid !important;
        grid-template-columns: 1fr auto;
        background: var(--bg-secondary);
        border-radius: var(--radius-md);
        border: 1px solid var(--border);
        overflow: hidden;
    }
    .table-dash td {
        border: none !important;
        padding: 0 !important;
        vertical-align: middle;
    }
    /* Horário */
    .table-dash td:nth-child(1) {
        grid-column: 1; grid-row: 1;
        padding: 12px 14px 6px !important;
    }
    /* Cliente — oculta avatar para economizar espaço */
    .table-dash td:nth-child(2) {
        grid-column: 1 / -1; grid-row: 2;
        padding: 0 14px 6px !important;
    }
    .table-dash td:nth-child(2) .avatar { display: none; }
    .table-dash td:nth-child(2) > div { gap: 0 !important; }
    /* Serviço */
    .table-dash td:nth-child(3) {
        grid-column: 1 / -1; grid-row: 3;
        padding: 0 14px 10px !important;
        max-width: none !important;
        font-size: 12px;
        color: var(--text-muted);
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
    /* Profissional — oculto na coluna, exibido dentro da célula de serviços */
    .table-dash td:nth-child(4) { display: none !important; }
    .dash-prof-hint { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); margin-top: 3px; }
    /* Valor */
    .table-dash td:nth-child(5) {
        grid-column: 1; grid-row: 4;
        padding: 8px 14px !important;
        border-top: 1px solid var(--border) !important;
        display: flex !important;
        align-items: center;
    }
    /* Status */
    .table-dash td:nth-child(6) {
        grid-column: 2; grid-row: 1;
        padding: 12px 14px 6px !important;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
    }
    /* Ações */
    .table-dash td:nth-child(7) {
        grid-column: 2; grid-row: 4;
        padding: 8px 14px !important;
        border-top: 1px solid var(--border) !important;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        gap: 4px;
    }

    /* ── Agendamentos: tabela completa → cards ── */
    .agd-table-wrapper {
        overflow-x: visible !important;
        border: none !important;
        border-radius: 0 !important;
        background: none !important;
        padding: 0 !important;
    }
    .table-agd { display: block !important; }
    .table-agd thead { display: none !important; }
    .table-agd tbody {
        display: flex !important;
        flex-direction: column;
        gap: 8px;
    }
    .table-agd tr {
        display: grid !important;
        grid-template-columns: 1fr auto;
        background: var(--bg-secondary);
        border-radius: var(--radius-md);
        border: 1px solid var(--border);
        overflow: hidden;
    }
    .table-agd td {
        border: none !important;
        padding: 0 !important;
        vertical-align: middle;
    }
    /* Data/Hora */
    .table-agd td:nth-child(1) {
        grid-column: 1; grid-row: 1;
        padding: 12px 14px 6px !important;
    }
    /* Cliente */
    .table-agd td:nth-child(2) {
        grid-column: 1 / -1; grid-row: 2;
        padding: 0 14px 6px !important;
    }
    /* Serviço(s) */
    .table-agd td:nth-child(3) {
        grid-column: 1 / -1; grid-row: 3;
        padding: 0 14px 6px !important;
        max-width: none !important;
        font-size: 12px !important;
        color: var(--text-muted) !important;
    }
    /* Profissional */
    .table-agd td:nth-child(4) {
        grid-column: 1; grid-row: 4;
        padding: 0 14px 8px !important;
        font-size: 12px !important;
        color: var(--text-muted) !important;
    }
    /* Valor */
    .table-agd td:nth-child(5) {
        grid-column: 2; grid-row: 4;
        padding: 0 14px 8px !important;
        font-size: 13px !important;
        text-align: right !important;
        display: flex !important;
        align-items: flex-end;
        justify-content: flex-end;
    }
    /* Origem — oculta no mobile */
    .table-agd td:nth-child(6) { display: none !important; }
    /* Status */
    .table-agd td:nth-child(7) {
        grid-column: 2; grid-row: 1;
        padding: 12px 14px 6px !important;
        display: flex !important;
        align-items: flex-start;
        justify-content: flex-end;
    }
    /* Ações */
    .table-agd td:nth-child(8) {
        grid-column: 1 / -1; grid-row: 5;
        padding: 8px 14px !important;
        border-top: 1px solid var(--border) !important;
        display: flex !important;
        gap: 6px !important;
        align-items: center;
    }

    /* ── Filtros de agendamentos — full width no mobile ── */
    .agd-filtros .form-group {
        min-width: 100% !important;
        flex: 1 1 100% !important;
    }
    .agd-filtros .btn {
        flex: 1 !important;
    }
}

@media (max-width: 480px) {
    /* Mantém 2 colunas nos KPI cards, apenas reduz padding */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .kpi-card {
        padding: 14px 12px;
    }
    .kpi-value {
        font-size: 22px;
    }

    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .tab {
        white-space: nowrap;
    }
}

/* ============================================================
   Utilitários
   ============================================================ */
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.gap-16       { gap: 16px; }
.flex-1       { flex: 1; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted   { color: var(--text-muted); }
.text-gold    { color: var(--gold); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-sm      { font-size: 12.5px; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.w-100         { width: 100%; }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- iOS: previne zoom automático em inputs (exige font-size >= 16px) ---- */
@media (hover: none) and (pointer: coarse) {
    input, select, textarea, .form-control {
        font-size: 16px !important;
    }

    /* Normaliza renderização nativa de date/time no iOS Safari */
    input[type="date"].form-control,
    input[type="time"].form-control {
        -webkit-appearance: none;
        appearance: none;
        line-height: 1.4;
        height: auto;
        min-height: 44px;
        padding: 10px 14px;
        display: flex;
        align-items: center;
    }
}
