/**
 * yoCare — App CSS
 * Stili globali, override Bootstrap, componenti condivisi.
 * Import prima di backend.css / frontend.css
 */

@import url('variables.css');

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--yc-font-sans);
    color: var(--yc-text);
    background-color: var(--yc-bg-light);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Override Bootstrap ───────────────────────────────────────────────────── */
:root {
    --bs-primary:        var(--yc-primary);
    --bs-primary-rgb:    var(--yc-primary-rgb);
    --bs-border-radius:  var(--yc-border-radius);
    --bs-font-sans-serif: var(--yc-font-sans);
    --bs-body-color:     var(--yc-text);
    --bs-body-bg:        var(--yc-bg-light);
    --bs-link-color:     var(--yc-primary);
    --bs-link-hover-color: var(--yc-primary-dark);
}

.btn-primary {
    --bs-btn-bg:          var(--yc-primary);
    --bs-btn-border-color: var(--yc-primary);
    --bs-btn-hover-bg:    var(--yc-primary-dark);
    --bs-btn-hover-border-color: var(--yc-primary-dark);
    --bs-btn-active-bg:   var(--yc-primary-dark);
}

.btn {
    font-weight: 500;
    transition: all var(--yc-transition);
}

.card {
    border: 1px solid var(--yc-border);
    border-radius: var(--yc-border-radius-lg);
}

.form-control,
.form-select {
    border-color: var(--yc-input-border);
    border-radius: var(--yc-border-radius);
    transition: border-color var(--yc-transition), box-shadow var(--yc-transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--yc-input-focus);
    box-shadow: 0 0 0 3px rgba(var(--yc-primary-rgb), .15);
}

.form-label {
    font-weight: var(--yc-label-weight);
    font-size: var(--yc-font-size-sm);
    color: var(--yc-gray-700);
    margin-bottom: 0.375rem;
}

.table {
    --bs-table-border-color: var(--yc-border);
}

.table th {
    font-size: var(--yc-font-size-sm);
    font-weight: 600;
    color: var(--yc-gray-600);
    white-space: nowrap;
    user-select: none;
}

.badge {
    font-weight: 500;
    letter-spacing: .01em;
}

/* ── Componenti yoCare ────────────────────────────────────────────────────── */

/* Avatar */
.yc-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
    background-color: var(--yc-primary-light);
    color: var(--yc-primary);
}

.yc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Badge status appuntamenti */
.yc-badge-pending    { background-color: #fef3c7; color: #92400e; }
.yc-badge-confirmed  { background-color: #dbeafe; color: #1e40af; }
.yc-badge-completed  { background-color: #dcfce7; color: #166534; }
.yc-badge-cancelled  { background-color: #f3f4f6; color: #374151; }
.yc-badge-no_show    { background-color: #fee2e2; color: #991b1b; }
.yc-badge-rescheduled{ background-color: #ede9fe; color: #5b21b6; }

/* Stat cards */
.yc-stat-card {
    background: var(--yc-bg-card);
    border: 1px solid var(--yc-border);
    border-radius: var(--yc-border-radius-lg);
    padding: 1.25rem;
    transition: box-shadow var(--yc-transition);
}

.yc-stat-card:hover {
    box-shadow: var(--yc-shadow-md);
}

.yc-stat-card__value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--yc-text);
}

.yc-stat-card__label {
    font-size: var(--yc-font-size-sm);
    color: var(--yc-text-muted);
    margin-top: 0.25rem;
}

.yc-stat-card__trend {
    font-size: var(--yc-font-size-xs);
    font-weight: 500;
}

.yc-stat-card__trend--up    { color: var(--yc-success); }
.yc-stat-card__trend--down  { color: var(--yc-danger); }
.yc-stat-card__trend--flat  { color: var(--yc-text-muted); }

/* Empty state */
.yc-empty-state {
    padding: 3rem 1.5rem;
}

.yc-empty-state__icon i {
    font-size: 3rem;
    color: var(--yc-gray-300);
}

/* Skeleton loader */
.yc-skeleton .placeholder {
    background-color: var(--yc-gray-200);
    border-radius: var(--yc-border-radius);
}

/* Table wrapper */
.yc-table-wrapper {
    background: var(--yc-bg-card);
    border-radius: var(--yc-border-radius-lg);
    border: 1px solid var(--yc-border);
    overflow: hidden;
}

.yc-table-actions .btn {
    padding: .25rem .5rem;
    font-size: var(--yc-font-size-xs);
}

[data-sortable="true"] {
    cursor: pointer;
}

[data-sortable="true"]:hover {
    background: var(--yc-gray-50);
}

[data-sortable="true"]::after {
    content: " ↕";
    opacity: .4;
    font-size: .65em;
}

[data-sortable="true"][data-sort-dir="asc"]::after  { content: " ↑"; opacity: .8; }
[data-sortable="true"][data-sort-dir="desc"]::after { content: " ↓"; opacity: .8; }

/* Page header */
.yc-page-header {
    margin-bottom: 1.5rem;
}

.yc-page-header__title h1 {
    color: var(--yc-gray-900);
}

/* Breadcrumb */
.breadcrumb-sm {
    --bs-breadcrumb-font-size: var(--yc-font-size-xs);
    --bs-breadcrumb-item-padding-x: .35rem;
    --bs-breadcrumb-divider-color: var(--yc-gray-400);
    color: var(--yc-text-muted);
}

/* Filters */
.yc-filters {
    background: var(--yc-bg-light) !important;
    border: 1px solid var(--yc-border) !important;
    border-radius: var(--yc-border-radius-lg) !important;
}

/* Form */
.yc-form .yc-form__actions {
    padding-top: 1rem;
    border-top: 1px solid var(--yc-border);
    margin-top: 1.5rem;
}

/* Alerts */
.yc-alert {
    border-left: 4px solid currentColor;
    border-radius: var(--yc-border-radius);
}

/* Toast */
#yc-toast-container .toast {
    min-width: 280px;
    max-width: 400px;
    border: none;
    box-shadow: var(--yc-shadow-lg);
    border-radius: var(--yc-border-radius-lg);
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.text-xs  { font-size: var(--yc-font-size-xs) !important; }
.text-sm  { font-size: var(--yc-font-size-sm) !important; }

.min-w-0 { min-width: 0; }

.cursor-pointer { cursor: pointer; }

.border-dashed {
    border-style: dashed !important;
}

/* ── CMS Array Editor ─────────────────────────────────────────────────────── */
.yc-cms-array-item {
    border: 1px solid #f0f0f0;
    border-radius: .5rem;
    padding: .75rem;
    margin-bottom: .75rem;
    background: #fafbfc;
    transition: border-color .15s;
}
.yc-cms-array-item:hover { border-color: #cbd5e1; }

/* ── CMS Upload Zone ─────────────────────────────────────────────────────── */
.yc-upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: .75rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    position: relative;
    overflow: hidden;
    min-height: 100px;
}
.yc-upload-zone:hover,
.yc-upload-zone.yc-upload-dragover {
    border-color: var(--yc-primary);
    background: var(--yc-primary-light);
}
.yc-upload-zone.yc-upload-loading {
    pointer-events: none;
    opacity: .7;
}
.yc-upload-label {
    font-size: .8rem;
    color: #6b7280;
    font-weight: 500;
}
.yc-upload-preview {
    position: relative;
    display: inline-block;
}
.yc-upload-preview img {
    max-width: 200px;
    max-height: 140px;
    object-fit: cover;
    border-radius: .5rem;
    border: 1px solid #e2e8f0;
}
.yc-upload-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .65rem;
    box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
.yc-upload-remove:hover { background: #dc2626; }
.yc-upload-progress {
    height: 4px;
    background: var(--yc-primary);
    border-radius: 999px;
    position: absolute;
    bottom: 0;
    left: 0;
    transition: width .2s;
}

/* ── Closed/unavailable slot pattern (globale, riusabile ovunque) ──────── */
.ws-closed,
.e-work-cells.ws-closed {
    background: repeating-linear-gradient(135deg, #ebebeb, #ebebeb 2px, #fff 2px, #fff 7px) !important;
}

/* Mini upload (inside JSON array items) */
.yc-upload-zone-mini {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 1.5px dashed #d1d5db;
    border-radius: .5rem;
    padding: .35rem .6rem;
    cursor: pointer;
    transition: border-color .15s;
    position: relative;
}
.yc-upload-zone-mini:hover,
.yc-upload-zone-mini.yc-upload-dragover {
    border-color: var(--yc-primary);
}
.yc-upload-mini-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: .35rem;
}
.yc-upload-mini-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--yc-primary);
}
.yc-upload-mini-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: 1.5px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .6rem;
    line-height: 1;
}

/* ── Print ────────────────────────────────────────────────────────────────── */
@media print {
    .yc-sidebar,
    .yc-topbar,
    .yc-page-header__actions,
    .yc-table-actions,
    .yc-filters,
    .btn,
    nav { display: none !important; }
}
