/* ==========================================================================
   NAVALHA DE OURO - ADMIN DASHBOARD STYLES (TOTALMENTE RESPONSIVO)
   ========================================================================== */

:root {
    --bg-dark: #0a0b0e;
    --bg-surface: #12141a;
    --bg-card: #181b24;
    --bg-card-hover: #1f232f;
    
    --primary: #d4af37;
    --primary-light: #f5d77f;
    --primary-glow: rgba(212, 175, 55, 0.25);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-gold: rgba(212, 175, 55, 0.3);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.12);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --font-heading: 'Cinzel', serif;
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
}

/* ================= LOGIN / PIN OVERLAY ================= */
.login-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #181b24 0%, #0a0b0e 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 0 35px rgba(212, 175, 55, 0.2);
}

.login-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid var(--border-gold);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 1.25rem auto;
}

.login-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: 0.4rem;
}

.login-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}

/* ================= ADMIN NAVBAR ================= */
.admin-navbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.admin-brand-name {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 1px;
}

.admin-brand-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid var(--border-gold);
    color: var(--primary);
}

.admin-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sync-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
    white-space: nowrap;
}

.sync-pulse {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ================= DASHBOARD LAYOUT ================= */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* KPI CARDS */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.kpi-card:hover {
    border-color: var(--border-gold);
    transform: translateY(-2px);
}

.kpi-info h4 {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}

.kpi-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.kpi-gold .kpi-icon { background: rgba(212, 175, 55, 0.15); color: var(--primary); }
.kpi-success .kpi-icon { background: var(--success-bg); color: var(--success); }
.kpi-info-color .kpi-icon { background: var(--info-bg); color: var(--info); }
.kpi-danger .kpi-icon { background: var(--danger-bg); color: var(--danger); }

/* ================= CONTROLS & TOOLBAR ================= */
.admin-toolbar {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.filter-control {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: var(--font-sans);
    transition: var(--transition);
}

.filter-control:focus {
    outline: none;
    border-color: var(--primary);
}

.search-input-wrapper {
    position: relative;
    min-width: 240px;
    flex: 1;
}

.search-input-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
}

.search-input-wrapper input {
    padding-left: 2.5rem;
    width: 100%;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ================= BUTTONS ================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    font-family: var(--font-sans);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #d4af37 0%, #b89726 100%);
    color: #0a0b0e;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #f5d77f 0%, #d4af37 100%);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-gold);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(212, 175, 55, 0.1);
    color: var(--primary);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.btn-whatsapp {
    background: rgba(37, 211, 102, 0.15);
    border: 1px solid rgba(37, 211, 102, 0.3);
    color: #25d366;
}

.btn-whatsapp:hover {
    background: #25d366;
    color: #0a0b0e;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.btn-danger-outline:hover {
    background: var(--danger-bg);
}

/* ================= APPOINTMENTS TABLE ================= */
.table-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.appointments-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.appointments-table th {
    background: #151821;
    padding: 1rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.appointments-table td {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    vertical-align: middle;
}

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

/* Details in cells */
.client-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.client-avatar-badge {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(212, 175, 55, 0.15);
    color: var(--primary);
    font-weight: 800;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-gold);
    flex-shrink: 0;
}

.client-name {
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.15rem;
}

.client-phone {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.datetime-badge {
    display: inline-flex;
    flex-direction: column;
    gap: 0.1rem;
}

.datetime-time {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary);
}

.datetime-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.service-badge {
    font-weight: 600;
    color: var(--text-main);
}

.barber-tag {
    font-size: 0.8rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.2rem;
}

.status-select {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    cursor: pointer;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ================= MODAL ================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg);
    max-width: 540px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

/* Toast container */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-gold);
    color: var(--text-main);
    padding: 0.75rem 1.15rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    animation: slideIn 0.25s ease;
}

@keyframes slideIn {
    from { transform: translateX(50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   SUPER RESPONSIVIDADE MOBILE (TELAS < 768px)
   ========================================================================== */
@media (max-width: 768px) {
    /* Navbar no Mobile */
    .admin-navbar {
        padding: 0.75rem 1rem;
    }

    .admin-brand-name {
        font-size: 1rem;
        letter-spacing: 0.5px;
    }

    .admin-brand-badge {
        display: none;
    }

    .sync-status-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.72rem;
    }

    .btn-text {
        display: none;
    }

    .admin-nav-actions .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }

    /* Container */
    .admin-container {
        padding: 1rem 0.75rem;
    }

    /* KPIs em Grade 2x2 elegante */
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.65rem;
        margin-bottom: 1.25rem;
    }

    .kpi-card {
        padding: 0.85rem;
        border-radius: var(--radius-sm);
    }

    .kpi-info h4 {
        font-size: 0.68rem;
        margin-bottom: 0.2rem;
    }

    .kpi-number {
        font-size: 1.35rem;
    }

    .kpi-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        border-radius: 8px;
    }

    /* Barra de Ferramentas / Filtros */
    .admin-toolbar {
        padding: 1rem 0.85rem;
        margin-bottom: 1.25rem;
        gap: 0.85rem;
    }

    .toolbar-filters {
        flex-direction: column;
        width: 100%;
        gap: 0.6rem;
    }

    .filter-control {
        width: 100%;
        font-size: 0.85rem;
        padding: 0.55rem 0.75rem;
    }

    .search-input-wrapper {
        width: 100%;
        min-width: 100%;
    }

    .toolbar-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .toolbar-actions .btn {
        width: 100%;
        font-size: 0.78rem;
        padding: 0.6rem 0.4rem;
        justify-content: center;
    }

    /* TRANSFORMA TABELA EM CARDS NATIVOS NO CELULAR */
    .table-container {
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .appointments-table,
    .appointments-table tbody,
    .appointments-table tr,
    .appointments-table td {
        display: block;
        width: 100%;
    }

    .appointments-table thead {
        display: none;
    }

    .appointments-table tr {
        background: var(--bg-surface);
        border: 1px solid var(--border-gold);
        border-radius: var(--radius-md);
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    }

    .appointments-table td {
        padding: 0.55rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
    }

    .appointments-table td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-dim);
        letter-spacing: 0.5px;
        text-align: left;
        flex-shrink: 0;
        margin-right: 0.5rem;
    }

    .appointments-table td:last-child {
        border-bottom: none;
        padding-top: 0.75rem;
        justify-content: stretch;
    }

    .appointments-table td:last-child::before {
        display: none;
    }

    .table-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 44px;
        gap: 0.5rem;
    }

    .table-actions .btn-whatsapp {
        width: 100%;
        justify-content: center;
        padding: 0.6rem;
    }

    .table-actions .btn-delete {
        width: 100%;
        justify-content: center;
        padding: 0.6rem;
    }

    /* Modal Form */
    .modal-card {
        max-width: 95%;
        padding: 0;
    }
    
    .modal-form-grid {
        grid-template-columns: 1fr;
    }
}
