/* Custom Fields Styles */

/* Container for custom fields panel */
.custom-fields-panel {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #e3e6f0;
    border-radius: 5px;
    background-color: #f8f9fc;
}

.custom-fields-panel h4 {
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
    text-align: center;
}

/* Individual field wrapper */
.custom-field-wrapper {
    margin-bottom: 20px;
}

.custom-field-wrapper label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

/* Required field indicator */
.custom-field-wrapper label .required-indicator {
    color: #e74a3b;
    margin-left: 4px;
}

/* Form controls styling */
.custom-field-wrapper input[type="text"],
.custom-field-wrapper input[type="number"],
.custom-field-wrapper input[type="date"],
.custom-field-wrapper textarea,
.custom-field-wrapper select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d3e2;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease-in-out;
}

.custom-field-wrapper input[type="text"]:focus,
.custom-field-wrapper input[type="number"]:focus,
.custom-field-wrapper input[type="date"]:focus,
.custom-field-wrapper textarea:focus,
.custom-field-wrapper select:focus {
    outline: none;
    border-color: #4e73df;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

/* Textarea specific */
.custom-field-wrapper textarea {
    resize: vertical;
    min-height: 80px;
    max-height: 200px;
}

/* Radio and checkbox styling */
.custom-field-wrapper .radio-group,
.custom-field-wrapper .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.custom-field-wrapper .radio-option,
.custom-field-wrapper .checkbox-option {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.custom-field-wrapper input[type="radio"],
.custom-field-wrapper input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.custom-field-wrapper .radio-option label,
.custom-field-wrapper .checkbox-option label {
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

/* Help text styling */
.custom-field-wrapper .help-text {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
}

/* Error state styling */
.custom-field-wrapper.has-error input,
.custom-field-wrapper.has-error textarea,
.custom-field-wrapper.has-error select {
    border-color: #e74a3b;
}

.custom-field-wrapper.has-error label {
    color: #e74a3b;
}

/* Loading state */
.custom-fields-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.custom-fields-loading .spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4e73df;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

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

/* Responsive design */
@media (max-width: 768px) {
    .custom-fields-panel {
        padding: 15px;
        margin: 15px -15px;
        border-radius: 0;
    }
    
    .custom-field-wrapper {
        margin-bottom: 15px;
    }
    
    .custom-field-wrapper input[type="text"],
    .custom-field-wrapper input[type="number"],
    .custom-field-wrapper input[type="date"],
    .custom-field-wrapper textarea,
    .custom-field-wrapper select {
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .radio-group,
    .checkbox-group {
        flex-direction: column;
        gap: 10px;
    }
}

/* Custom field display in confirmation/history views */
.custom-fields-display {
    margin: 20px 0;
}

.custom-fields-display hr {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid #e3e6f0;
}

.custom-fields-display h4 {
    margin-bottom: 15px;
    color: #333;
    font-weight: 600;
}

.custom-field-display-item {
    margin-bottom: 10px;
}

.custom-field-display-item strong {
    color: #333;
    margin-right: 5px;
}

/* History view expandable details */
.booking-history-details {
    background-color: #f8f9fa;
    padding: 20px;
    border-top: 2px solid #e3e6f0;
}

.booking-history-details h5 {
    margin-bottom: 15px;
    color: #333;
    font-weight: 600;
}

.booking-history-details .custom-field-item {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dotted #dee2e6;
}

.booking-history-details .custom-field-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Collapse button animation */
.btn[data-toggle="collapse"] i {
    transition: transform 0.3s ease;
}

.btn[data-toggle="collapse"][aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Print styles */
@media print {
    .custom-fields-panel {
        border: 1px solid #ddd;
        background-color: white;
    }
    
    .custom-fields-display {
        page-break-inside: avoid;
    }
    
    .btn[data-toggle="collapse"] {
        display: none;
    }
    
    .collapse {
        display: block !important;
    }
}