/*
 * BarberBooking - Custom Styles
 * 
 * CUSTOMIZATION GUIDE:
 * - Fonts: Change --font-display (headings) and --font-body (text) 
 * - Colors: Change --color-primary for main accent color
 * - Radius: Change --radius for global border-radius
 * - All colors adapt automatically for dark mode
 */

:root {
    /* === FONTS === */
    --font-display: 'Inter', sans-serif;       /* Titles, headings */
    --font-body: 'Inter', sans-serif;           /* Body text, paragraphs */

    /* === PRIMARY / ACCENT COLOR === */
    --color-primary: #2669dc;
    --color-primary-hover: #1c6ab9;
    --color-primary-light: rgba(220, 38, 38, 0.1);
    --color-primary-shadow: rgba(220, 38, 38, 0.25);

    /* === BORDER RADIUS === */
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;

    /* === LIGHT MODE COLORS === */
    --bg-page: #f7f7f8;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f2f2f4;
    --border-color: #e4e4e7;
    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #a1a1aa;

    /* === TRANSITIONS === */
    --transition: 200ms ease;
}

.dark {
    --bg-page: #111113;
    --bg-surface: #1a1a1d;
    --bg-surface-hover: #242427;
    --border-color: #2e2e33;
    --text-primary: #f0f0f2;
    --text-secondary: #a1a1aa;
    --text-muted: #63636e;
}

/* === BASE STYLES === */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary-light) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background: var(--color-primary-light);
    border-radius: var(--radius-full);
}
*::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-page);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .font-display {
    font-family: var(--font-display);
}

/* === COMPONENT STYLES === */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover {
    border-color: var(--color-primary);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-sm);
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px var(--color-primary-shadow);
    transition: background var(--transition), transform var(--transition);
    border: none;
    cursor: pointer;
}
.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: border-color var(--transition), background var(--transition);
    cursor: pointer;
}
.btn-secondary:hover {
    border-color: var(--color-primary);
    background: var(--bg-surface-hover);
}

.btn-danger {
    background: transparent;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: background var(--transition);
    cursor: pointer;
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.input-field {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    padding: 0.625rem 0.875rem !important;
    color: var(--text-primary) !important;
    font-size: 0.875rem !important;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    width: 100%;
    outline: none !important;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none !important;
    ring: none;
}
/* Allow padding overrides for icon-prefixed inputs */
.input-field.pl-10, .input-field[class*="pl-"] {
    padding-left: 2.5rem !important;
}
.input-field:hover {
    border-color: color-mix(in srgb, var(--color-primary) 40%, var(--border-color)) !important;
}
.input-field:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px var(--color-primary-light) !important;
    background: var(--bg-surface) !important;
    outline: none !important;
    --tw-ring-shadow: none !important;
}
.input-field::placeholder {
    color: var(--text-muted);
}
.dark .input-field {
    background: var(--bg-surface-hover) !important;
}
.dark .input-field:focus {
    background: var(--bg-surface) !important;
}

/* Override Tailwind forms plugin base styles globally */
[type='text'], [type='email'], [type='url'], [type='password'],
[type='number'], [type='date'], [type='datetime-local'], [type='month'],
[type='search'], [type='tel'], [type='time'], [type='week'],
select, textarea {
    --tw-ring-shadow: 0 0 #0000 !important;
    --tw-ring-color: transparent !important;
}
[type='text']:focus, [type='email']:focus, [type='url']:focus, [type='password']:focus,
[type='number']:focus, [type='date']:focus, [type='datetime-local']:focus, [type='month']:focus,
[type='search']:focus, [type='tel']:focus, [type='time']:focus, [type='week']:focus,
select:focus, textarea:focus {
    --tw-ring-shadow: 0 0 #0000 !important;
    --tw-ring-color: transparent !important;
    outline: none !important;
    box-shadow: none;
}
/* Apply our styles to all .input-field types with max specificity */
input.input-field, select.input-field, textarea.input-field,
input.input-field[type='text'], input.input-field[type='email'],
input.input-field[type='password'], input.input-field[type='number'],
input.input-field[type='tel'], input.input-field[type='time'],
input.input-field[type='date'], input.input-field[type='search'],
input.input-field[type='url'] {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: none !important;
    --tw-ring-shadow: 0 0 #0000 !important;
    outline: none !important;
}
input.input-field:focus, select.input-field:focus, textarea.input-field:focus,
input.input-field[type='text']:focus, input.input-field[type='email']:focus,
input.input-field[type='password']:focus, input.input-field[type='number']:focus,
input.input-field[type='tel']:focus, input.input-field[type='time']:focus,
input.input-field[type='date']:focus, input.input-field[type='search']:focus,
input.input-field[type='url']:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px var(--color-primary-light) !important;
    --tw-ring-shadow: 0 0 #0000 !important;
    outline: none !important;
}
.dark input.input-field, .dark select.input-field, .dark textarea.input-field {
    background: var(--bg-surface-hover) !important;
}
.dark input.input-field:focus, .dark select.input-field:focus, .dark textarea.input-field:focus {
    background: var(--bg-surface) !important;
}

/* Select field enhancements */
select.input-field {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    padding-right: 2.25rem !important;
}

/* Checkbox & radio refinement */
input[type="checkbox"], input[type="radio"] {
    accent-color: var(--color-primary);
}
input[type="checkbox"]:focus, input[type="radio"]:focus {
    --tw-ring-shadow: 0 0 #0000 !important;
    --tw-ring-color: transparent !important;
    box-shadow: 0 0 0 2px var(--color-primary-light) !important;
    outline: none !important;
}
input[type="checkbox"]:checked, input[type="radio"]:checked {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

/* Textarea */
textarea.input-field {
    resize: vertical;
    min-height: 5rem;
}

/* Badge styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.5;
}
.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}
.dark .badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}
.badge-warning {
    background: rgba(234, 179, 8, 0.1);
    color: #ca8a04;
}
.dark .badge-warning {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
}
.badge-danger {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border-color);
    border-radius: var(--radius-full);
    transition: var(--transition);
}
.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--color-primary);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Sidebar active state */
.sidebar-link.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    transform: translateX(120%);
    transition: transform 300ms ease;
    max-width: 400px;
}
.toast.show {
    transform: translateX(0);
}
.toast-success {
    background: #16a34a;
    color: white;
}
.toast-error {
    background: #dc2626;
    color: white;
}
.toast-info {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.spinner-primary {
    border-color: var(--color-primary-light);
    border-top-color: var(--color-primary);
}

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

/* No scrollbar utility */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Modal overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    max-width: 640px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    transform: scale(0.95);
    transition: transform 200ms ease;
}
.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Step indicator */
.step-dot {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    transition: all var(--transition);
}
.step-dot.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 12px var(--color-primary-shadow);
}
.step-dot.completed {
    background: var(--color-primary);
    color: white;
}
.step-dot.inactive {
    background: var(--border-color);
    color: var(--text-muted);
}

/* Responsive table */
@media (max-width: 768px) {
    .responsive-table {
        display: block;
        overflow-x: auto;
    }
}

/* Pulse animation for live indicators */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.animate-pulse-dot {
    animation: pulse-dot 2s ease-in-out infinite;
}

/* === BACKGROUND PATTERN === */
body {
    background-image: url('/assets/bg-light.png');
    background-repeat: repeat;
    background-size: 256px 256px;
}
.dark body, body.dark {
    background-image: url('/assets/bg-dark.png');
}

/* Badge primary variant */
.badge-primary {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

/* Rounded custom */
.rounded-custom { border-radius: var(--radius); }
.rounded-custom-sm { border-radius: var(--radius-sm); }
.rounded-custom-lg { border-radius: var(--radius-lg); }

/* Primary text/bg utility */
.text-primary { color: var(--color-primary); }
.bg-primary { background-color: var(--color-primary); }
.bg-primary\/5 { background-color: color-mix(in srgb, var(--color-primary) 5%, transparent); }
.bg-primary\/10 { background-color: color-mix(in srgb, var(--color-primary) 10%, transparent); }
.border-primary { border-color: var(--color-primary); }

/* ========== BOOKING TIMELINE ========== */
.tl-wrap {
    display: flex;
    flex-direction: column;
    position: relative;
}
.tl-row {
    display: flex;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}
.tl-row.hour {
    border-top-width: 1px;
    border-top-color: var(--border-color);
}
.tl-row.half {
    border-top-style: dashed;
    border-top-color: color-mix(in srgb, var(--border-color) 60%, transparent);
}
.tl-row.sub {
    border-top-style: dotted;
    border-top-color: color-mix(in srgb, var(--border-color) 35%, transparent);
}
.tl-time {
    width: 3rem;
    flex-shrink: 0;
    text-align: right;
    padding-right: 0.5rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    padding-top: 0.15rem;
    user-select: none;
}
.tl-cell {
    flex: 1;
    position: relative;
    min-height: 100%;
    transition: background 0.1s ease;
}
.tl-cell:hover {
    background: color-mix(in srgb, var(--color-primary) 3%, transparent);
}

/* Overlay blocks (breaks, appointments, past) */
.tl-block {
    position: absolute;
    left: 3rem;
    right: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
    display: flex;
    align-items: center;
}
.tl-block-past {
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 6px,
        color-mix(in srgb, var(--text-muted) 6%, transparent) 6px,
        color-mix(in srgb, var(--text-muted) 6%, transparent) 7px
    );
    z-index: 3;
}
.tl-block-break {
    background: color-mix(in srgb, var(--text-muted) 8%, var(--bg-surface));
    border-left: 3px solid var(--text-muted);
    border-radius: var(--radius-sm);
    margin-left: 2px;
    margin-right: 2px;
    color: var(--text-muted);
}
.tl-block-booked {
    background: color-mix(in srgb, var(--color-primary) 8%, var(--bg-surface));
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
    margin-left: 2px;
    margin-right: 2px;
    color: var(--text-secondary);
}

/* Preview block (hover) */
.tl-preview {
    position: absolute;
    left: 3rem;
    right: 0;
    z-index: 5;
    pointer-events: none;
    background: color-mix(in srgb, var(--color-primary) 10%, var(--bg-surface));
    border: 2px dashed var(--color-primary);
    border-radius: var(--radius-sm);
    margin-left: 2px;
    margin-right: 2px;
    opacity: 0.75;
    transition: top 0.1s ease, opacity 0.15s ease;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
}

/* Selected block */
.tl-selected {
    position: absolute;
    left: 3rem;
    right: 0;
    z-index: 4;
    pointer-events: none;
    background: color-mix(in srgb, var(--color-primary) 15%, var(--bg-surface));
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-sm);
    margin-left: 2px;
    margin-right: 2px;
    box-shadow: 0 4px 12px var(--color-primary-shadow);
    overflow: hidden;
    display: flex;
    align-items: flex-start;
}

/* After Hour block overlay */
.tl-block-afterhour {
    background: rgba(139, 92, 246, 0.06);
    border-left: 3px solid #8b5cf6;
    border-radius: var(--radius-sm);
    margin-left: 2px;
    margin-right: 2px;
    color: #6d28d9;
    z-index: 1;
}
.dark .tl-block-afterhour {
    background: rgba(139, 92, 246, 0.08);
    color: #a78bfa;
}

/* ========== DESIGN FIXES ========== */

/* Material Icons vertical alignment in flex containers */
.material-icons {
    vertical-align: middle;
    line-height: 1;
}

/* Buttons with only an icon: square aspect ratio */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    flex-shrink: 0;
}
.btn-icon:hover {
    border-color: var(--color-primary);
    background: var(--bg-surface-hover);
}
.btn-icon.sm {
    width: 1.75rem;
    height: 1.75rem;
}
.btn-icon.lg {
    width: 2.75rem;
    height: 2.75rem;
}

/* Input fields with icon prefix: increase left padding to avoid text overlap */
.input-with-icon {
    padding-left: 2.75rem !important;
}

/* Week view alignment fix: consistent height for cells */
.week-time {
    height: 2rem;
    min-height: 2rem;
    box-sizing: border-box;
}
.week-cell {
    height: 2rem;
    min-height: 2rem;
    position: relative;
    box-sizing: border-box;
}

/* No-show status: always red */
.badge-no-show {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #dc2626 !important;
}
.dark .badge-no-show {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
}
