/* ============================================================
   ORATORIO BOOKING – Foglio di stile principale
   Responsive, mobile-first
   ============================================================ */

/* ---- Google Font ---- */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

/* ---- Variabili ---- */
:root {
    --primary:      #1d6fa4;
    --primary-dark: #145480;
    --primary-light:#e8f3fb;
    --accent:       #f0a500;
    --danger:       #c0392b;
    --success:      #27ae60;
    --warning:      #e67e22;
    --pending:      #8e44ad;
    --text:         #2c3e50;
    --text-light:   #6c7a89;
    --border:       #d5e3ee;
    --bg:           #f0f5fa;
    --white:        #ffffff;
    --radius:       10px;
    --radius-sm:    6px;
    --shadow:       0 2px 12px rgba(29,111,164,.12);
    --shadow-hover: 0 6px 20px rgba(29,111,164,.22);
    --transition:   .2s ease;
    --font:         'Nunito', sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 40px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ---- Contenitore principale ---- */
.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---- Header ---- */
.site-header {
    background: var(--primary);
    color: var(--white);
    padding: 14px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.site-header .container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-header .logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -.3px;
    color: var(--white);
}

.site-header .logo-text span {
    color: var(--accent);
}

/* ---- Navbar admin ---- */
.admin-bar {
    background: var(--primary-dark);
    padding: 8px 0;
    font-size: .85rem;
}

.admin-bar .container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
}

.admin-bar a {
    color: #cce4f7;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
}

.admin-bar a:hover {
    background: rgba(255,255,255,.15);
    color: var(--white);
    text-decoration: none;
}

/* ---- Breadcrumb / pagina ---- */
.page-header {
    background: var(--white);
    border-bottom: 3px solid var(--primary-light);
    padding: 24px 0 20px;
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.page-header .subtitle {
    color: var(--text-light);
    font-size: .9rem;
}

/* ---- Card ---- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-light);
}

/* ---- Statistiche admin ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 16px;
    text-align: center;
    border-top: 4px solid var(--primary);
    transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.stat-card.pending  { border-top-color: var(--pending); }
.stat-card.approved { border-top-color: var(--success); }
.stat-card.rejected { border-top-color: var(--danger); }

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    display: block;
}

.stat-label {
    font-size: .78rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 4px;
    display: block;
}

/* ---- Navigazione a link ---- */
.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--white);
    color: var(--primary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: .875rem;
    font-weight: 700;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.nav-links a:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    text-decoration: none;
}

/* ---- Tabelle ---- */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--white);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

table th {
    background: var(--primary);
    color: var(--white);
    font-weight: 700;
    text-align: left;
    padding: 11px 14px;
    white-space: nowrap;
}

table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table tbody tr:last-child td {
    border-bottom: none;
}

table tbody tr:hover {
    background: var(--primary-light);
}

/* ---- Badge stato ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}

.badge-pending  { background: #f0e6fa; color: var(--pending); }
.badge-approved { background: #e8f8ef; color: var(--success); }
.badge-rejected { background: #fde9e7; color: var(--danger); }
.badge-cancelled{ background: #f1f3f5; color: var(--text-light); }

/* ---- Bottoni ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .9rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.btn:active { transform: scale(.97); }
.btn:hover  { text-decoration: none; }

.btn-primary {
    background: var(--primary);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(29,111,164,.3);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}
.btn-success:hover {
    background: #1e9150;
    color: var(--white);
    box-shadow: 0 4px 12px rgba(39,174,96,.3);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}
.btn-danger:hover {
    background: #a93226;
    color: var(--white);
    box-shadow: 0 4px 12px rgba(192,57,43,.3);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.btn-sm {
    padding: 6px 14px;
    font-size: .8rem;
}

.btn-lg {
    padding: 13px 32px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
    display: flex;
}

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

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

.form-label .required {
    color: var(--danger);
    margin-left: 3px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .9rem;
    color: var(--text);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29,111,164,.12);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231d6fa4' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

.form-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary);
}

.form-check label {
    font-size: .875rem;
    cursor: pointer;
    line-height: 1.4;
}

.form-hint {
    font-size: .78rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* ---- Alert ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    margin-bottom: 20px;
    border-left: 4px solid transparent;
}

.alert-success {
    background: #e8f8ef;
    color: #1e6b40;
    border-color: var(--success);
}

.alert-danger {
    background: #fde9e7;
    color: #8c1a12;
    border-color: var(--danger);
}

.alert-warning {
    background: #fef5e7;
    color: #7d4e0a;
    border-color: var(--accent);
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary);
}

/* ---- Login Telegram ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a5f8f 0%, #0d3d5e 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-icon {
    width: 72px;
    height: 72px;
    background: var(--primary-light);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.login-icon svg {
    width: 40px;
    height: 40px;
    fill: var(--primary);
}

.login-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-light);
    font-size: .9rem;
    margin-bottom: 28px;
}

.telegram-btn-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

/* ---- Pagina connect bot ---- */
.steps-list {
    list-style: none;
    counter-reset: step;
    margin: 20px 0;
}

.steps-list li {
    counter-increment: step;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
    font-size: .9rem;
    line-height: 1.5;
}

.steps-list li::before {
    content: counter(step);
    min-width: 30px;
    height: 30px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .85rem;
    flex-shrink: 0;
}

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

.cal-header {
    text-align: center;
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    padding: 6px 0;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 600;
    cursor: default;
}

/* ---- Risultato prenotazione ---- */
.booking-result {
    max-width: 560px;
    margin: 40px auto;
    text-align: center;
}

.booking-result .result-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.detail-list {
    list-style: none;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 20px 0;
    text-align: left;
}

.detail-list li {
    display: flex;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
    gap: 12px;
}

.detail-list li:last-child { border-bottom: none; }

.detail-list li strong {
    min-width: 130px;
    color: var(--text-light);
    font-weight: 600;
}

/* ---- Note rifiuto ---- */
.rejection-note {
    background: #fde9e7;
    color: #8c1a12;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: .82rem;
    border-left: 3px solid var(--danger);
}

/* ---- Azioni tabella ---- */
.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ---- Testo vuoto ---- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-light);
}

.empty-state p {
    font-size: 1rem;
    margin-top: 8px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {

    .page-header h1 { font-size: 1.3rem; }

    .card { padding: 18px 14px; }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .stat-value { font-size: 1.6rem; }

    table th, table td {
        padding: 9px 10px;
        font-size: .82rem;
    }

    /* Sulle schermate piccole le tabelle scorrevoli orizzontalmente */
    .table-wrapper {
        border-radius: var(--radius-sm);
    }

    .admin-bar .container {
        gap: 6px 10px;
        font-size: .8rem;
    }
}

@media (max-width: 480px) {

    body { font-size: 15px; }

    .login-card {
        padding: 28px 20px;
    }

    .login-title { font-size: 1.25rem; }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-value { font-size: 1.4rem; }
    .stat-label { font-size: .7rem; }

    .btn { padding: 10px 16px; font-size: .85rem; }
    .btn-lg { padding: 12px 24px; font-size: .95rem; }

    .nav-links a {
        padding: 8px 12px;
        font-size: .82rem;
    }

    /* Su mobile mostra solo alcune colonne nelle tabelle */
    table th:nth-child(1),
    table td:nth-child(1) {
        display: none; /* nasconde colonna ID su schermi piccoli */
    }

    .detail-list li {
        flex-direction: column;
        gap: 2px;
    }

    .detail-list li strong { min-width: auto; }
}

/* ---- Utility ---- */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); font-size: .875rem; }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
