/* ===================================================================
   CUP ASL AVELLINO - STILI COMPLETI CALENDARIO E PRENOTAZIONI
   File: assets/cup-styles.css
================================================================= */

/* Reset e Base */
.cup-calendario-wrapper,
.cup-prenotazioni-container {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.cup-calendario-wrapper *,
.cup-prenotazioni-container * {
    box-sizing: border-box;
}

/* ===================================================================
   CALENDARIO - CONTAINER PRINCIPALE
   ================================================================= */

.cup-calendario-wrapper {
    max-width: 900px;
    margin: 20px auto;
    padding: 25px;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fbff 0%, #f0f7ff 100%);
    box-shadow: 0 4px 20px rgba(0, 115, 170, 0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
}

.cup-calendario-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0073aa, #005a87, #0099cc);
    border-radius: 12px 12px 0 0;
}

/* ===================================================================
   CALENDARIO - HEADER
   ================================================================= */

.cup-calendario-header {
    text-align: center;
    margin-bottom: 25px;
}

.cup-calendario-header h3 {
    margin: 0 0 20px 0;
    color: #0073aa;
    font-size: 24px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 115, 170, 0.1);
}

.cup-filtro-ambulatorio {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.05);
}

.cup-filtro-ambulatorio label {
    display: inline-block;
    margin-right: 12px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.cup-filtro-ambulatorio select {
    padding: 10px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #2c3e50;
    transition: all 0.3s ease;
    min-width: 200px;
}

.cup-filtro-ambulatorio select:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

/* ===================================================================
   CALENDARIO - LEGENDA
   ================================================================= */

.cup-calendario-legend {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.05);
}

.cup-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    padding: 5px 10px;
    border-radius: 15px;
    background: #f8f9fa;
    transition: transform 0.2s ease;
}

.cup-legend-item:hover {
    transform: translateY(-2px);
}

.cup-legend-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cup-day-available { 
    background: linear-gradient(135deg, #d4edda, #c3e6cb) !important; 
}
.cup-day-partial { 
    background: linear-gradient(135deg, #fff3cd, #ffeaa7) !important; 
}
.cup-day-full { 
    background: linear-gradient(135deg, #f8d7da, #f5c6cb) !important; 
}
.cup-day-none { 
    background: linear-gradient(135deg, #e2e3e5, #d1ecf1) !important; 
}

/* ===================================================================
   CALENDARIO - NAVIGAZIONE
   ================================================================= */

.cup-calendario-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    background: white;
    padding: 20px 25px;
    border-radius: 10px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 2px 12px rgba(0, 115, 170, 0.08);
}

.cup-nav-btn {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
    position: relative;
    overflow: hidden;
}

.cup-nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.cup-nav-btn:hover {
    background: linear-gradient(135deg, #005a87, #004973);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.4);
}

.cup-nav-btn:hover::before {
    left: 100%;
}

.cup-nav-btn:active {
    transform: translateY(0);
}

#cup-current-month {
    margin: 0;
    color: #0073aa;
    font-size: 22px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 115, 170, 0.1);
}

/* ===================================================================
   CALENDARIO - GRIGLIA
   ================================================================= */

.cup-calendario-grid {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e1e8ed;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0, 115, 170, 0.1);
}

.cup-calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
}

.cup-calendar-day-name {
    padding: 16px 12px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.cup-calendar-day-name:last-child {
    border-right: none;
}

.cup-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.cup-calendar-day {
    min-height: 90px;
    border: 1px solid #f0f3f6;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    background: #ffffff;
    transition: all 0.3s ease;
}

.cup-calendar-day.cup-day-clickable {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.cup-calendar-day.cup-day-clickable::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 115, 170, 0.05), rgba(0, 153, 204, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cup-calendar-day.cup-day-clickable:hover {
    transform: translateY(-3px);
    z-index: 10;
    box-shadow: 0 8px 25px rgba(0, 115, 170, 0.2);
    border-color: #0073aa;
}

.cup-calendar-day.cup-day-clickable:hover::before {
    opacity: 1;
}

.cup-calendar-day.cup-day-today {
    border: 2px solid #0073aa;
    font-weight: bold;
    background: linear-gradient(135deg, #e7f3ff, #f0f8ff);
    box-shadow: 0 0 15px rgba(0, 115, 170, 0.3);
    position: relative;
}

.cup-calendar-day.cup-day-today::after {
    content: 'OGGI';
    position: absolute;
    top: 5px;
    right: 5px;
    background: #0073aa;
    color: white;
    font-size: 9px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 8px;
    letter-spacing: 0.5px;
}

.cup-calendar-day.cup-day-past {
    opacity: 0.4;
    background: #f8f9fa;
    color: #6c757d;
}

.cup-calendar-day.cup-day-empty {
    background: #fbfcfd;
    opacity: 0.3;
}

.cup-day-number {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    z-index: 2;
    position: relative;
}

.cup-day-availability {
    font-size: 11px;
    color: #6c757d;
    text-align: center;
    margin-top: 8px;
    line-height: 1.3;
    font-weight: 500;
    z-index: 2;
    position: relative;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 4px;
    border-radius: 10px;
    backdrop-filter: blur(2px);
}

/* ===================================================================
   CALENDARIO - LOADING
   ================================================================= */

.cup-calendario-loading {
    text-align: center;
    padding: 50px 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 4px 20px rgba(0, 115, 170, 0.1);
}

.cup-spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: cup-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes cup-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================================================
   CALENDARIO - INFO BOX
   ================================================================= */

.cup-calendario-info {
    background: linear-gradient(135deg, #ffffff, #f8fbff);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e1e8ed;
    margin-top: 25px;
    box-shadow: 0 2px 12px rgba(0, 115, 170, 0.05);
}

.cup-calendario-info p {
    margin: 0 0 15px 0;
    font-weight: 600;
    color: #0073aa;
    font-size: 16px;
}

.cup-calendario-info ul {
    margin: 0;
    padding-left: 20px;
}

.cup-calendario-info li {
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 14px;
    line-height: 1.5;
}

/* ===================================================================
   MODAL CALENDARIO
   ================================================================= */

.cup-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cup-modal-content {
    background: white;
    margin: 3% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideInScale 0.4s ease-out;
}

@keyframes slideInScale {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.cup-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0073aa, #005a87, #0099cc);
}

.cup-modal-close {
    color: #6c757d;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 20px;
    transition: all 0.3s ease;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cup-modal-close:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
    transform: rotate(90deg);
}

#cup-modal-title {
    margin: 0;
    padding: 25px 25px 20px 25px;
    color: #0073aa;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 2px solid #f0f3f6;
    background: linear-gradient(135deg, #f8fbff, #ffffff);
}

#cup-modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.cup-ambulatorio-details {
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffffff, #f8fbff);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cup-ambulatorio-details::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #0073aa, #0099cc);
}

.cup-ambulatorio-details:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 115, 170, 0.15);
    border-color: #0073aa;
}

.cup-ambulatorio-details h5 {
    margin: 0 0 15px 0;
    color: #0073aa;
    font-size: 18px;
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f3f6;
}

.cup-availability-info p {
    margin: 8px 0;
    color: #2c3e50;
    font-size: 14px;
    line-height: 1.5;
}

.cup-availability-count {
    font-weight: 700;
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    padding: 3px 8px;
    border-radius: 15px;
    font-size: 13px;
}

.cup-btn-small-primary {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
    margin-top: 15px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
    position: relative;
    overflow: hidden;
}

.cup-btn-small-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.cup-btn-small-primary:hover {
    background: linear-gradient(135deg, #005a87, #004973);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.4);
}

.cup-btn-small-primary:hover::before {
    left: 100%;
}

.cup-btn-primary {
    background: linear-gradient(135deg, #0073aa, #005a87) !important;
    color: white !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3) !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    position: relative !important;
    overflow: hidden !important;
}

.cup-btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.cup-btn-primary:hover {
    background: linear-gradient(135deg, #005a87, #004973) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.4) !important;
}

.cup-btn-primary:hover::before {
    left: 100%;
}

.cup-no-availability {
    color: #dc3545;
    font-style: italic;
    font-size: 14px;
    font-weight: 500;
    background: rgba(220, 53, 69, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 10px;
    display: inline-block;
}

.cup-modal-actions {
    background: linear-gradient(135deg, #f8fbff, #ffffff);
    margin: 0 -25px -25px -25px;
    padding: 20px 25px;
    border-top: 2px solid #f0f3f6;
}

/* ===================================================================
   FORM PRENOTAZIONI - CONTAINER PRINCIPALE
   ================================================================= */

#cup-prenotazioni-container {
    max-width: 900px;
    margin: 20px auto;
    padding: 30px;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
    box-shadow: 0 4px 20px rgba(0, 115, 170, 0.1);
    position: relative;
}

#cup-prenotazioni-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0073aa, #005a87, #0099cc);
    border-radius: 12px 12px 0 0;
}

#cup-prenotazioni-container > h3 {
    margin: 0 0 25px 0;
    color: #0073aa;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 115, 170, 0.1);
}

/* ===================================================================
   FORM PRENOTAZIONI - BANNER CALENDARIO
   ================================================================= */

.cup-calendario-context {
    background: linear-gradient(135deg, #e7f3ff, #f0f8ff);
    border: 2px solid #0073aa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.15);
    position: relative;
    overflow: hidden;
}

.cup-calendario-context::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(135deg, #0073aa, #0099cc);
}

.cup-calendario-context h4 {
    margin: 0 0 15px 0;
    color: #0073aa;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cup-calendario-context h4 span {
    background: #0073aa;
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ===================================================================
   FORM PRENOTAZIONI - SEZIONI
   ================================================================= */

.cup-section {
    background: white;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 12px;
    border: 2px solid #f0f3f6;
    box-shadow: 0 2px 12px rgba(0, 115, 170, 0.05);
    position: relative;
    transition: all 0.3s ease;
}

.cup-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #0073aa, #0099cc);
    border-radius: 12px 0 0 12px;
}

.cup-section:hover {
    border-color: #e1e8ed;
    box-shadow: 0 4px 20px rgba(0, 115, 170, 0.1);
}

.cup-section h4 {
    margin: 0 0 20px 0;
    color: #0073aa;
    font-size: 18px;
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f3f6;
}

.cup-row {
    display: flex;
    gap: 25px;
    margin-bottom: 20px;
}

.cup-col {
    flex: 1;
}

.cup-col-full {
    width: 100%;
}

.cup-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.cup-row input,
.cup-row select,
.cup-row textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.cup-row input:focus,
.cup-row select:focus,
.cup-row textarea:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
    background: #f8fbff;
}

.cup-row input[type="date"]::-webkit-calendar-picker-indicator {
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="%230073aa"><path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z"/></svg>') no-repeat;
    color: #0073aa;
}

.cup-row small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    font-style: italic;
    color: #0073aa;
    font-weight: 500;
}

/* ===================================================================
   FORM PRENOTAZIONI - BOTTONI
   ================================================================= */

.cup-btn-primary {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    padding: 16px 30px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cup-btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s ease;
}

.cup-btn-primary:hover {
    background: linear-gradient(135deg, #005a87, #004973);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
}

.cup-btn-primary:hover::before {
    left: 100%;
}

.cup-btn-primary:active {
    transform: translateY(-1px);
}

.cup-btn-primary:disabled {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===================================================================
   MESSAGGI DI FEEDBACK
   ================================================================= */

.cup-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 2px solid #28a745;
    color: #155724;
    padding: 20px 25px;
    border-radius: 10px;
    margin-top: 25px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2);
    position: relative;
    animation: slideInUp 0.5s ease-out;
}

.cup-success::before {
    content: '✅';
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 20px;
}

.cup-error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border: 2px solid #dc3545;
    color: #721c24;
    padding: 20px 25px;
    border-radius: 10px;
    margin-top: 25px;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.2);
    position: relative;
    animation: slideInUp 0.5s ease-out;
}

.cup-error::before {
    content: '❌';
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 20px;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================================================
   ANIMAZIONI E LOADING
   ================================================================= */

#cup-orari-loading {
    font-style: italic;
    color: #0073aa;
    font-size: 12px;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* Overlay Redirect */
#cup-redirect-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 10000 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* ===================================================================
   DEBUG CONSOLE
   ================================================================= */

#cup-debug {
    background: linear-gradient(135deg, #f0f8ff, #e7f3ff);
    border: 2px solid #0073aa;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.15);
}

#cup-debug h4 {
    color: #0073aa;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#cup-debug-content div {
    padding: 5px 0;
    border-bottom: 1px solid rgba(0, 115, 170, 0.1);
    font-size: 11px;
}

/* ===================================================================
   RESPONSIVE DESIGN
   ================================================================= */

@media (max-width: 768px) {
    .cup-calendario-wrapper,
    #cup-prenotazioni-container {
        margin: 10px;
        padding: 20px;
    }
    
    .cup-calendario-header h3,
    #cup-prenotazioni-container > h3 {
        font-size: 20px;
    }
    
    .cup-calendario-legend {
        gap: 15px;
    }
    
    .cup-legend-item {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .cup-calendar-day {
        min-height: 70px;
        padding: 8px;
    }
    
    .cup-day-number {
        font-size: 16px;
    }
    
    .cup-day-availability {
        font-size: 10px;
    }
    
    .cup-modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 0;
    }
    
    #cup-modal-title {
        padding: 20px;
        font-size: 18px;
    }
    
    #cup-modal-body {
        padding: 20px;
    }
    
    .cup-ambulatorio-details {
        padding: 15px;
    }
    
    .cup-calendario-navigation {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .cup-nav-btn {
        width: 100%;
        padding: 12px;
    }
    
    .cup-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .cup-section {
        padding: 20px;
    }
    
    .cup-filtro-ambulatorio {
        padding: 12px 15px;
    }
    
    .cup-filtro-ambulatorio select {
        min-width: 100%;
        margin-top: 8px;
    }
    
    .cup-filtro-ambulatorio label {
        display: block;
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .cup-calendario-context > div {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    #cup-redirect-overlay {
        font-size: 16px !important;
    }
    
    #cup-redirect-overlay .cup-spinner {
        width: 35px !important;
        height: 35px !important;
    }
}

@media (max-width: 480px) {
    .cup-calendar-day {
        min-height: 60px;
        padding: 6px;
    }
    
    .cup-calendar-day-name {
        padding: 10px 6px;
        font-size: 12px;
    }
    
    .cup-day-number {
        font-size: 14px;
    }
    
    .cup-day-availability {
        font-size: 9px;
    }
    
    .cup-calendario-wrapper,
    #cup-prenotazioni-container {
        padding: 15px;
    }
    
    .cup-section {
        padding: 15px;
    }
    
    .cup-btn-primary {
        padding: 14px 20px;
        font-size: 14px;
    }
    
    #cup-redirect-overlay {
        font-size: 14px !important;
    }
    
    .cup-ambulatorio-details h5 {
        font-size: 16px;
    }
    
    .cup-btn-small-primary {
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* ===================================================================
   UTILITY CLASSES
   ================================================================= */

.cup-text-center { text-align: center; }
.cup-text-left { text-align: left; }
.cup-text-right { text-align: right; }

.cup-mt-10 { margin-top: 10px; }
.cup-mt-20 { margin-top: 20px; }
.cup-mb-10 { margin-bottom: 10px; }
.cup-mb-20 { margin-bottom: 20px; }

.cup-hidden { display: none; }
.cup-visible { display: block; }

/* ===================================================================
   PRINT STYLES
   ================================================================= */

@media print {
    .cup-calendario-wrapper,
    #cup-prenotazioni-container {
        box-shadow: none;
        border: 1px solid #000;
        background: white;
    }
    
    .cup-nav-btn,
    #cup-debug,
    .cup-modal {
        display: none !important;
    }
    
    .cup-calendar-day {
        border: 1px solid #000;
    }

/* Autocomplete Indirizzi */
.ui-autocomplete {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    background: white;
    border: 2px solid #0073aa;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 115, 170, 0.2);
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    z-index: 10000 !important;
}

.ui-menu .ui-menu-item {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cup-autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f3f6;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cup-autocomplete-item:last-child {
    border-bottom: none;
}

.ui-state-active .cup-autocomplete-item,
.ui-state-focus .cup-autocomplete-item {
    background: linear-gradient(135deg, #e7f3ff, #f0f8ff);
    padding-left: 20px;
}

.cup-icon {
    font-size: 16px;
    min-width: 20px;
}

.cup-address-text {
    flex: 1;
    line-height: 1.4;
}

/* Indicatore di ricerca */
#indirizzo_paziente.searching {
    background-image: url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><style>@keyframes spin { to { transform: rotate(360deg); } }</style><circle cx="8" cy="8" r="6" fill="none" stroke="%230073aa" stroke-width="2" stroke-dasharray="9" stroke-dashoffset="3" style="animation: spin 1s linear infinite;"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
    padding-right: 35px;
}

/* Nasconde l'helper di accessibilità di jQuery UI */
.ui-helper-hidden-accessible {
    position: absolute;
    left: -9999px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .ui-autocomplete {
        max-height: 250px;
        font-size: 16px;
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
    }
    
    .cup-autocomplete-item {
        padding: 15px;
    }
/* Dialog Numero Civico */
.cup-civico-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cup-civico-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    position: relative;
}

.cup-civico-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0073aa, #005a87, #0099cc);
    border-radius: 12px 12px 0 0;
}

.cup-civico-content h4 {
    margin: 0 0 15px 0;
    color: #0073aa;
    font-size: 18px;
}

.cup-civico-content p {
    margin: 0 0 20px 0;
    color: #333;
}

.cup-civico-input-group {
    margin-bottom: 20px;
}

.cup-civico-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

#cup-civico-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

#cup-civico-input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.cup-civico-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.cup-civico-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cup-civico-cancel {
    background: #6c757d;
    color: white;
}

.cup-civico-cancel:hover {
    background: #5a6268;
}

.cup-civico-confirm {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.cup-civico-confirm:hover {
    background: linear-gradient(135deg, #005a87, #004973);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.4);
}

/* Indicatore numero civico nell'autocomplete */
.cup-autocomplete-item small {
    color: #666;
    font-size: 12px;
    font-style: italic;
    margin-left: 5px;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .cup-civico-content {
        padding: 20px;
    }
    
    .cup-civico-content h4 {
        font-size: 16px;
    }
    
    .cup-civico-buttons {
        flex-direction: column;
    }
    
    .cup-civico-buttons button {
        width: 100%;
    }
}
/* Animazione shake per errori */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Fix per z-index elevati */
.cup-civico-dialog {
    position: fixed !important;
    z-index: 99999 !important;
}

/* Assicurati che il dialog sia sopra tutto */
body > .cup-civico-dialog {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
}

}