/* ============================================================
   PrenoTaglio — App CSS (Cliente)
   Mobile-first, CSS custom properties per colori tenant
   ============================================================ */

/* Variabili di default (override da PHP inline style) */
:root {
    --color-primary: #1a1a2e;
    --color-secondary: #16213e;
    --color-accent: #e94560;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-500: #6b7280;
    --color-gray-700: #374151;
    --color-gray-900: #111827;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.16);
    --transition: .2s ease;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--color-gray-50);
    color: var(--color-gray-900);
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--color-primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ────────────────────────────────────────────────────────────
   Layout & Header
   ──────────────────────────────────────────────────────────── */
.app-header {
    background: var(--color-primary);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.app-header .logo {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -.5px;
}

.app-header .user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .9rem;
}

.app-main {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 16px 80px;
}

/* ────────────────────────────────────────────────────────────
   Bottoni
   ──────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    transition: opacity var(--transition), transform var(--transition);
    line-height: 1;
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}
.btn-primary:hover:not(:disabled) { opacity: .88; }

.btn-secondary {
    background: var(--color-gray-100);
    color: var(--color-gray-700);
    border: 2px solid var(--color-gray-200);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--color-primary);
    padding: 8px 12px;
}

.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: .875rem; }

/* ────────────────────────────────────────────────────────────
   Step Wizard Indicator
   ──────────────────────────────────────────────────────────── */
.steps {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 28px;
    padding: 0;
    list-style: none;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--color-gray-200);
    z-index: 0;
}

.step.done::after,
.step.active::after {
    background: var(--color-primary);
}

.step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-gray-200);
    color: var(--color-gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
    transition: background var(--transition), color var(--transition);
}

.step.active .step-dot {
    background: var(--color-primary);
    color: #fff;
}

.step.done .step-dot {
    background: var(--color-success);
    color: #fff;
}

.step-label {
    font-size: .7rem;
    margin-top: 6px;
    color: var(--color-gray-500);
    text-align: center;
    font-weight: 500;
}

.step.active .step-label { color: var(--color-primary); font-weight: 700; }

/* ────────────────────────────────────────────────────────────
   Griglia Servizi
   ──────────────────────────────────────────────────────────── */
.services-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 360px) {
    .services-grid { grid-template-columns: 1fr; }
}

.service-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.service-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.service-card.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb, 26,26,46), .15);
}

.service-card-photo {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: var(--color-gray-100);
}

.service-card-photo-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--color-gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--color-gray-500);
}

.service-card-body {
    padding: 12px;
}

.service-card-name {
    font-weight: 700;
    font-size: .95rem;
    color: var(--color-gray-900);
    margin-bottom: 4px;
}

.service-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .8rem;
    color: var(--color-gray-500);
}

.service-card-price {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 1rem;
}

/* ────────────────────────────────────────────────────────────
   Calendario disponibilità (griglia mese)
   ──────────────────────────────────────────────────────────── */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-nav-title {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: capitalize;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day-header {
    text-align: center;
    font-size: .7rem;
    font-weight: 700;
    color: var(--color-gray-500);
    padding: 4px 0;
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
}

.calendar-day.empty { cursor: default; }

.calendar-day.past {
    color: var(--color-gray-200);
    cursor: not-allowed;
}

.calendar-day.available {
    background: #d1fae5;
    color: #065f46;
}
.calendar-day.available:hover { background: #a7f3d0; }

.calendar-day.full {
    background: #fee2e2;
    color: #991b1b;
    cursor: not-allowed;
}

.calendar-day.closed {
    background: var(--color-gray-100);
    color: var(--color-gray-200);
    cursor: not-allowed;
}

.calendar-day.selected {
    background: var(--color-primary) !important;
    color: #fff !important;
}

.calendar-day.today {
    border: 2px solid var(--color-primary);
}

/* ────────────────────────────────────────────────────────────
   Lista slot orari
   ──────────────────────────────────────────────────────────── */
.slots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media (max-width: 360px) {
    .slots-grid { grid-template-columns: repeat(2, 1fr); }
}

.slot {
    padding: 12px 8px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    font-size: .875rem;
    border: 2px solid transparent;
    transition: all var(--transition);
    cursor: pointer;
}

.slot.available {
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}
.slot.available:hover {
    background: #a7f3d0;
    border-color: #6ee7b7;
}

.slot.occupied {
    background: var(--color-gray-100);
    color: var(--color-gray-200);
    cursor: not-allowed;
    border-color: var(--color-gray-200);
}

.slot.selected {
    background: var(--color-primary) !important;
    color: #fff !important;
    border-color: var(--color-primary) !important;
}

.slot-time { font-size: 1rem; }
.slot-end { font-size: .75rem; opacity: .75; }

/* ────────────────────────────────────────────────────────────
   Form Login / Registrazione
   ──────────────────────────────────────────────────────────── */
.auth-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 32px 24px;
    max-width: 420px;
    margin: 32px auto;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    color: var(--color-gray-900);
}

.auth-subtitle {
    text-align: center;
    color: var(--color-gray-500);
    margin-bottom: 28px;
    font-size: .9rem;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: .875rem;
    color: var(--color-gray-700);
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--color-gray-200);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color var(--transition);
    background: #fff;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-input.error { border-color: var(--color-danger); }

.form-error {
    font-size: .8rem;
    color: var(--color-danger);
    margin-top: 4px;
}

.auth-toggle {
    text-align: center;
    margin-top: 20px;
    font-size: .9rem;
    color: var(--color-gray-500);
}

.auth-toggle a {
    color: var(--color-primary);
    font-weight: 600;
}

/* ────────────────────────────────────────────────────────────
   Riepilogo prenotazione
   ──────────────────────────────────────────────────────────── */
.summary-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 20px;
}

.summary-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--color-gray-900);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-gray-100);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    font-size: .9rem;
}

.summary-row:not(:last-child) {
    border-bottom: 1px solid var(--color-gray-50);
}

.summary-label {
    color: var(--color-gray-500);
    flex: 0 0 40%;
}

.summary-value {
    font-weight: 600;
    color: var(--color-gray-900);
    text-align: right;
    flex: 1;
}

.summary-price {
    font-size: 1.2rem;
    color: var(--color-primary);
}

/* ────────────────────────────────────────────────────────────
   Lista prenotazioni cliente
   ──────────────────────────────────────────────────────────── */
.booking-list { space-y: 12px; }

.booking-item {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 18px;
    margin-bottom: 12px;
    border-left: 4px solid var(--color-primary);
}

.booking-item.cancelled {
    border-left-color: var(--color-gray-200);
    opacity: .65;
}

.booking-item.completed {
    border-left-color: var(--color-success);
}

.booking-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.booking-item-name {
    font-weight: 700;
    font-size: 1rem;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.badge-confirmed  { background: #dbeafe; color: #1e40af; }
.badge-completed  { background: #d1fae5; color: #065f46; }
.badge-cancelled  { background: var(--color-gray-100); color: var(--color-gray-500); }
.badge-no-show    { background: #fee2e2; color: #991b1b; }

.booking-item-meta {
    font-size: .85rem;
    color: var(--color-gray-500);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* ────────────────────────────────────────────────────────────
   Alert / Toast
   ──────────────────────────────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: .9rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ────────────────────────────────────────────────────────────
   Loading spinner
   ──────────────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0,0,0,.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

/* ────────────────────────────────────────────────────────────
   Sezione titolo
   ──────────────────────────────────────────────────────────── */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-gray-900);
    margin-bottom: 16px;
}

.section-subtitle {
    font-size: .875rem;
    color: var(--color-gray-500);
    margin-bottom: 20px;
}

/* ────────────────────────────────────────────────────────────
   Bottom navigation (mobile)
   ──────────────────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 16px rgba(0,0,0,.1);
    display: flex;
    z-index: 90;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 4px;
    font-size: .7rem;
    color: var(--color-gray-500);
    cursor: pointer;
    transition: color var(--transition);
    gap: 3px;
    border: none;
    background: none;
}

.bottom-nav-item.active {
    color: var(--color-primary);
}

.bottom-nav-item .nav-icon {
    font-size: 1.4rem;
}

/* ────────────────────────────────────────────────────────────
   Textarea / Note
   ──────────────────────────────────────────────────────────── */
textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* ────────────────────────────────────────────────────────────
   Transizioni Vue
   ──────────────────────────────────────────────────────────── */
.fade-enter-active, .fade-leave-active {
    transition: opacity .25s ease;
}
.fade-enter-from, .fade-leave-to {
    opacity: 0;
}

.slide-up-enter-active, .slide-up-leave-active {
    transition: all .3s ease;
}
.slide-up-enter-from {
    transform: translateY(20px);
    opacity: 0;
}
.slide-up-leave-to {
    transform: translateY(-10px);
    opacity: 0;
}

/* ────────────────────────────────────────────────────────────
   Utility
   ──────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-2 { margin-bottom: 8px; }
.text-muted { color: var(--color-gray-500); }
.text-small { font-size: .875rem; }
.divider {
    border: none;
    border-top: 1px solid var(--color-gray-100);
    margin: 20px 0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--color-gray-500);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 6px; color: var(--color-gray-700); }
