/* Prenotazioni Online - Admin styles */

.medaid-po-dashboard { display: grid; gap: 1.5rem; min-width: 0; }
.medaid-po-dashboard .po-card { min-width: 0; max-width: 100%; }
.medaid-po-dashboard .po-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.medaid-po-stat { background: var(--white, #fff); border-radius: 8px; padding: 1.25rem; border: 1px solid #e8e8e8; }
.medaid-po-stat h4 { margin: 0 0 0.25rem; font-size: 0.85rem; color: #888; font-weight: 400; }
.medaid-po-stat .value { font-size: 1.5rem; font-weight: 700; color: #264A87; }
.medaid-po-stat .value.success { color: #27AE60; }
.medaid-po-stat .value.warning { color: #E67E22; }
.medaid-po-stat .value.danger { color: #E74C3C; }

/* Cards */
.po-card { background: var(--white, #fff); border-radius: 8px; padding: 1.5rem; border: 1px solid #e8e8e8; }
.po-card h3 { margin: 0 0 1rem; font-size: 1.1rem; }
.po-card--alert { border-left: 4px solid #E67E22; }
.po-card--success { border-left: 4px solid #27AE60; }

/* Status badges */
.po-badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.po-badge--pending { background: #FFF3CD; color: #856404; }
.po-badge--confirmed { background: #D4EDDA; color: #155724; }
.po-badge--cancelled { background: #F8D7DA; color: #721C24; }
.po-badge--published { background: #D4EDDA; color: #155724; }
.po-badge--draft { background: #E2E3E5; color: #383D41; }

/* Tables */
.po-table-scroll {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.po-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.po-table.po-table--bookings { min-width: 960px; }
.po-table.po-table--services { min-width: 1100px; }
.po-table th { text-align: left; padding: 0.75rem; border-bottom: 2px solid #e8e8e8; font-weight: 600; color: #555; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.po-table td { padding: 0.75rem; border-bottom: 1px solid #f0f0f0; }
.po-table tr:hover td { background: #f8f9fa; }
.po-table .po-actions { white-space: nowrap; }
.po-table .po-cell-actions { min-width: 7rem; vertical-align: top; }
.po-table .po-cell-policy { min-width: 8.5rem; vertical-align: top; }

/* Sticky first column keeps context while scrolling horizontally */
.po-table th:first-child,
.po-table td:first-child { position: sticky; left: 0; background: #fff; z-index: 1; }
.po-table thead th:first-child { z-index: 2; }
.po-table tr:hover td:first-child { background: #f8f9fa; }

/* Mobile scroll hint shown above wide tables */
.po-table-scroll-hint {
    display: none;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 0.5rem;
}
.po-table-scroll-hint::before { content: '\2194'; margin-right: 0.35rem; }

/* Payment methods checkboxes layout */
.medaid-po-dashboard .form-check { display: flex; align-items: flex-start; gap: 0.5rem; }
.medaid-po-dashboard .form-check-input { flex-shrink: 0; margin: 0.2rem 0 0; }
.medaid-po-dashboard .form-check-label { line-height: 1.4; word-break: break-word; }
.po-methods-checks { display: grid; gap: 0.75rem; }
@media (min-width: 768px) {
    .po-methods-checks { grid-template-columns: 1fr 1fr; }
}

/* Toggle switches */
.po-toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.po-toggle input { opacity: 0; width: 0; height: 0; }
.po-toggle .slider { position: absolute; cursor: pointer; inset: 0; background: #ccc; border-radius: 24px; transition: 0.3s; }
.po-toggle .slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s; }
.po-toggle input:checked + .slider { background: #264A87; }
.po-toggle input:checked + .slider::before { transform: translateX(20px); }

/* Page builder */
.po-pb-blocks { list-style: none; padding: 0; margin: 0; }
.po-pb-block { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1rem; border: 1px solid #e8e8e8; border-radius: 8px; margin-bottom: 0.5rem; background: #fff; cursor: grab; }
.po-pb-block.disabled { opacity: 0.5; }
.po-pb-block .drag-handle { cursor: grab; color: #aaa; font-size: 1.2rem; }
.po-pb-block .block-info { flex: 1; }
.po-pb-block .block-info h5 { margin: 0; font-size: 0.9rem; }
.po-pb-block .block-info p { margin: 0; font-size: 0.8rem; color: #888; }

/* Page builder - auto-save status indicator */
.po-pb-status { font-size: 0.8rem; color: #888; min-width: 0; }
.po-pb-status[data-state="dirty"]  { color: #b45309; }
.po-pb-status[data-state="saving"] { color: #2563eb; }
.po-pb-status[data-state="saved"]  { color: #15803d; }
.po-pb-status[data-state="error"]  { color: #b91c1c; }
.po-pb-status[data-state="saving"]::before {
    content: ''; display: inline-block; width: 10px; height: 10px;
    border: 2px solid rgba(37,99,235,0.25); border-top-color: #2563eb;
    border-radius: 50%; animation: po-spin 0.6s linear infinite;
    vertical-align: -2px; margin-right: 0.4rem;
}
.po-pb-status[data-state="saved"]::before  { content: '✓ '; }
.po-pb-status[data-state="error"]::before  { content: '⚠ '; }
.po-pb-status[data-state="dirty"]::before  { content: '● '; }

/* Palette picker */
.po-palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.75rem; }
.po-palette-preset { border: 2px solid #e8e8e8; border-radius: 8px; padding: 0.75rem; cursor: pointer; text-align: center; transition: border-color 0.2s; }
.po-palette-preset:hover, .po-palette-preset.active { border-color: #264A87; }
.po-palette-preset .swatches { display: flex; gap: 3px; justify-content: center; margin-bottom: 0.5rem; }
.po-palette-preset .swatch { width: 20px; height: 20px; border-radius: 50%; }
.po-palette-preset .label { font-size: 0.8rem; font-weight: 500; }

/* Availability rules */
.po-rule-row { display: grid; grid-template-columns: 100px 1fr 1fr 80px 80px auto; gap: 0.5rem; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid #f0f0f0; }
.po-rule-row input, .po-rule-row select { padding: 0.4rem 0.6rem; border: 1px solid #ddd; border-radius: 4px; font-size: 0.85rem; }

/* Loading spinner */
.po-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: po-spin 0.6s linear infinite; vertical-align: middle; }
@keyframes po-spin { to { transform: rotate(360deg); } }

/* Quick stats mini */
.medaid-po-stat .value { transition: color 0.2s; }
.medaid-po-stat:hover { border-color: #264A87; }

/* Responsive */
@media (max-width: 992px) {
    .medaid-po-dashboard .po-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .medaid-po-dashboard > .d-flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .medaid-po-dashboard .po-stats { grid-template-columns: 1fr 1fr; }
    .po-rule-row { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .po-table { font-size: 0.8rem; }
    .po-table th, .po-table td { padding: 0.5rem; }
    .po-pb-block { flex-wrap: wrap; }
    .po-palette-grid { grid-template-columns: repeat(2, 1fr); }
    .po-card h3 { font-size: 1rem; }
    .po-table-scroll-hint { display: block; }
    .po-table .po-actions { white-space: normal; display: flex; flex-wrap: wrap; gap: 0.25rem; }
    .po-table .svc-vtype { width: 100% !important; max-width: 100%; }
}
@media (max-width: 480px) {
    .medaid-po-dashboard .po-stats { grid-template-columns: 1fr; }
    .po-rule-row { grid-template-columns: 1fr; }
}
