﻿@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --bk-primary: #2563eb;
    --bk-text: #1e293b;
    --bk-bg: #f8fafc;
    --bk-border: #e2e8f0;
    --bk-radius: 12px;
}

body,
.bk-main-wrapper,
.bk-admin-app {
    font-family: 'Poppins', sans-serif !important;
}

.bk-main-wrapper,
.bk-main-wrapper *,
.bk-modal-overlay,
.bk-modal-overlay * {
    box-sizing: border-box;
}

.bk-main-wrapper {
    max-width: 800px;
    margin: 30px auto;
    padding: 30px;
    background: #fff;
    border-radius: var(--bk-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--bk-border);
}

/* Card Style for Admin & Dashboards */
.bk-card {
    background: #fff;
    padding: 30px;
    border-radius: var(--bk-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--bk-border);
    margin-bottom: 20px;
}

.bk-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--bk-text);
    margin-bottom: 20px;
}

.bk-btn {
    background: #f1f5f9;
    color: #1e293b;
    padding: 12px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    transition: 0.2s ease;
    line-height: 1.5;
    text-decoration: none;
    display: inline-block;
}

.bk-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #0f172a;
    transform: translateY(-1px);
}

.bk-btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* Secondary / Ghost Button (Cinza Discreto) */
.bk-btn-ghost {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.bk-btn-ghost:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Danger Outline (Vermelho Borda Fina) */
.bk-btn-danger-outline {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
}

.bk-btn-danger-outline:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #dc2626;
}

/* Success Outline (Verde Borda Fina) */
.bk-btn-success-outline {
    background: transparent;
    border: 1px solid #22c55e;
    color: #22c55e;
}

.bk-btn-success-outline:hover {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #16a34a;
}

/* Cancel / Outline Default */
.bk-btn-outline {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #64748b;
}

.bk-btn-outline:hover {
    background: #f8fafc;
    color: #334155;
    border-color: #94a3b8;
}

/* FormulÃ¡rios (Profile & Outros) */
.bk-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.bk-form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
}

.bk-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--bk-border);
    border-radius: 8px;
    font-size: 1rem;
}

/* Grid de Slots */
.bk-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.bk-time-slot {
    padding: 10px;
    border: 1px solid var(--bk-border);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
}

.bk-time-slot:hover {
    border-color: var(--bk-primary);
    color: var(--bk-primary);
}

.bk-time-slot.selected {
    background: var(--bk-primary);
    color: #fff;
    border-color: var(--bk-primary);
}

/* --- NOVO CALENDÃRIO VISUAL --- */
.bk-calendar-wrapper {
    border: 1px solid var(--bk-border);
    border-radius: var(--bk-radius);
    padding: 20px;
}

.bk-cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.bk-cal-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.bk-cal-nav {
    background: none;
    border: 1px solid var(--bk-border);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bk-cal-nav:hover {
    background: #f1f5f9;
}

.bk-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
}

.bk-cal-day-name {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 10px;
}

.bk-cal-day {
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}

.bk-cal-day:hover:not(.disabled) {
    background: #eff6ff;
    color: var(--bk-primary);
}

.bk-cal-day.selected {
    background: var(--bk-primary);
    color: #fff;
}

.bk-cal-day.disabled {
    color: #cbd5e1;
    cursor: not-allowed;
}

.bk-cal-day.today {
    border: 1px solid var(--bk-primary);
}

/* Admin */
.bk-admin-section {
    margin-top: 20px;
    padding: 20px;
    background: var(--bk-bg);
    border-radius: 10px;
    border: 1px solid var(--bk-border);
}

.bk-hour-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

/* Booking Cards Grid */
.bk-bookings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.bk-booking-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s ease;
}

/* New Styles for v4.46 */
.bk-filter-tab,
.bk-blog-tab {
    background: #f1f5f9;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 500;
    transition: all 0.2s;
}

.bk-filter-tab:hover,
.bk-blog-tab:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.bk-filter-tab.active,
.bk-blog-tab.active {
    background: #3b82f6 !important;
    color: #fff !important;
}

.bk-filter-tab.active:hover,
.bk-blog-tab.active:hover {
    background: #2563eb !important;
}

.bk-highlight-today {
    border: 2px solid #3b82f6;
    position: relative;
}

.bk-card-completed {
    opacity: 0.75;
    background: #f8fafc;
}

@media screen and (max-width: 768px) {
    .bk-table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .bk-bookings-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.bk-booking-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--bk-primary);
}

.bk-booking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
    margin-bottom: 5px;
}

.bk-booking-date {
    font-weight: 600;
    color: var(--bk-text);
    display: flex;
    align-items: center;
    gap: 5px;
}

.bk-booking-status {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
}

.bk-booking-body p {
    margin: 5px 0;
    color: #475569;
    font-size: 0.9rem;
}

.bk-booking-actions {
    margin-top: auto;
    padding-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* --- RESPONSIVE UTILITIES & REFACTORED INLINE STYLES --- */

/* Services Manager Form */
.bk-service-form-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: 2fr 1fr 1fr 1fr;
}

/* Financial Report */
.bk-report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.bk-report-cards {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

/* List Items (Generic) */
.bk-list-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Day Config Header */
.bk-day-header {
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Responsive Table Wrapper */
.bk-table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Client Toolbar */
.bk-client-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* --- MOBILE MEDIA QUERIES (< 768px) --- */
@media screen and (max-width: 768px) {

    .bk-main-wrapper,
    .bk-card {
        padding: 20px;
        margin: 10px auto;
        border-radius: 8px;
    }

    .bk-btn {
        width: 100%;
        /* Full width buttons on mobile usually better */
        margin-bottom: 5px;
        text-align: center;
        padding: 14px;
        /* Larger touch target */
    }

    .bk-btn-sm {
        width: auto;
        /* Exception for small action buttons */
        padding: 8px 12px !important;
    }

    /* Stack Grids */
    .bk-service-form-grid {
        grid-template-columns: 1fr;
    }

    /* Stack Flex Containers */
    .bk-report-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .bk-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .bk-list-item>div {
        width: 100%;
        display: flex;
        gap: 5px;
        justify-content: space-between;
        /* Spread buttons */
    }

    .bk-client-toolbar {
        width: 100%;
        gap: 10px;
        /* Remove flex-direction: column to keep them in row */
        justify-content: space-between;
    }

    .bk-client-toolbar input#client_search {
        flex: 1 1 100%;
        max-width: 100% !important;
        order: -1;
    }

    /* Wrap the export buttons to take remaining space */
    .bk-client-toolbar>div:first-of-type {
        flex: 1;
        display: flex;
        gap: 5px;
    }

    .bk-client-toolbar>div:first-of-type .bk-btn-sm {
        flex: 1;
        text-align: center;
        padding: 8px 5px !important;
        font-size: 11px !important;
        white-space: nowrap;
    }

    /* Keep the toggle view buttons grouped and normal sized */
    .bk-client-toolbar>div:last-child {
        flex: 0 0 auto;
    }

    .bk-client-toolbar>div:last-child .bk-btn-sm {
        width: auto !important;
        padding: 8px 10px !important;
    }



    .bk-service-item {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }

    .bk-service-item button {
        width: 100%;
    }

    /* Inputs larger for touch */
    .bk-input {
        font-size: 16px;
        /* Prevents zoom on iOS */
        padding: 14px;
    }

    h3 {
        font-size: 1.2rem;
    }
}

/* View Toggle Active State */
.bk-view-toggle.active,
.pub-view-toggle.active {
    background: #2563eb !important;
    color: #fff !important;
    border-color: #2563eb !important;
}

/* Base Toggle Button */
.bk-toggle-btn {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bk-toggle-btn:hover {
    color: #0f172a;
    background: #e2e8f0;
}

.bk-toggle-btn.active {
    background: #fff;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Modal Styles */
.bk-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.bk-modal-content {
    background: #fff;
    width: 90%;
    max-width: 600px;
    padding: 25px;
    border-radius: 12px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

.bk-modal-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.bk-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #1e293b;
}

.bk-form-group {
    margin-bottom: 15px;
}

.bk-form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #334155;
    font-size: 0.9rem;
}

.bk-form-row {
    display: flex;
    gap: 15px;
}

.bk-modal-actions {
    margin-top: 25px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
}

.bk-modal-actions .bk-btn {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
}

.bk-modal-actions .bk-btn:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

.bk-modal-actions .bk-btn:last-child {
    background: #2563eb !important;
    color: #fff !important;
    border-color: #2563eb !important;
}

.bk-modal-actions .bk-btn:last-child:hover {
    background: #1d4ed8 !important;
    color: #fff !important;
    border-color: #1d4ed8 !important;
}

.bk-table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 600px) {
    .bk-form-row {
        flex-direction: column;
        gap: 10px;
    }

    .bk-modal-actions {
        flex-direction: column-reverse;
    }

    .bk-modal-actions .bk-btn {
        width: 100%;
    }
}

/* Categoria Grid Responsivo */
.bk-category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
}

@media (max-width: 992px) {
    .bk-category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .bk-category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Client Card Mobile Adjustment */
@media (max-width: 768px) {
    .bk-client-card-header {
        flex-direction: column-reverse;
        align-items: flex-start !important;
        gap: 0;
    }

    .bk-client-badge {
        align-self: flex-end;
        margin-bottom: 15px;
    }
}