/* Animal Shelter Companion - Public Styles */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.asc-boarding-form {
    max-width: 800px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

.asc-boarding-form * {
    box-sizing: border-box;
}

/* ==========================================================================
   Form Sections
   ========================================================================== */

.asc-form-section {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.asc-form-section legend {
    font-weight: 600;
    font-size: 18px;
    color: #2c3e50;
    padding: 0 12px;
    margin-bottom: 16px;
    border: none;
    background: none;
}

/* ==========================================================================
   Form Fields
   ========================================================================== */

.asc-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.asc-form-row .asc-form-field {
    flex: 1;
}

.asc-form-field {
    margin-bottom: 16px;
}

.asc-form-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: #2c3e50;
    font-size: 14px;
}

.asc-form-field input[type="text"],
.asc-form-field input[type="email"],
.asc-form-field input[type="tel"],
.asc-form-field input[type="date"],
.asc-form-field input[type="number"],
.asc-form-field select,
.asc-form-field textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
}

.asc-form-field input:focus,
.asc-form-field select:focus,
.asc-form-field textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.asc-form-field input.error,
.asc-form-field select.error,
.asc-form-field textarea.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.asc-form-field textarea {
    resize: vertical;
    min-height: 80px;
}

.required {
    color: #e74c3c;
    font-weight: bold;
}

/* ==========================================================================
   Form Controls
   ========================================================================== */

.asc-radio-group,
.asc-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Boarding type specific styling */
.asc-radio-group .asc-radio-option {
    position: relative;
    padding: 18px 20px;
    min-height: 80px;
}

.asc-radio-group .asc-radio-option input[type="radio"] {
    position: absolute;
    top: 18px;
    left: 18px;
}

.asc-radio-group .radio-label {
    margin-left: 32px;
    gap: 6px;
}

.asc-radio-option,
.asc-checkbox-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.asc-radio-option:hover,
.asc-checkbox-option:hover {
    background-color: #f8f9fa;
    border-color: #3498db;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.15);
}

.asc-radio-option input[type="radio"]:checked + .radio-label {
    color: #2c3e50;
}

/* Modern browsers with :has() support */
.asc-radio-option:has(input[type="radio"]:checked),
.asc-checkbox-option:has(input[type="checkbox"]:checked) {
    border-color: #3498db;
    background-color: #f0f8ff;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
}

/* Fallback for browsers without :has() support */
.asc-radio-option.selected,
.asc-checkbox-option.selected {
    border-color: #3498db;
    background-color: #f0f8ff;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
}

.asc-radio-option input[type="radio"]:checked,
.asc-checkbox-option input[type="checkbox"]:checked {
    transform: scale(1.05);
}

.asc-radio-option input[type="radio"],
.asc-checkbox-option input[type="checkbox"] {
    margin: 0;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: #3498db;
}

.radio-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    line-height: 1.4;
}

.radio-label small {
    color: #666;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.3;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.asc-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.asc-button-primary {
    background: #3498db;
    color: white;
}

.asc-button-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.asc-button-secondary {
    background: #95a5a6;
    color: white;
}

.asc-button-secondary:hover {
    background: #7f8c8d;
}

.asc-button-danger {
    background: transparent;
    color: #e74c3c;
}

.asc-button-danger:hover {
    background: #fee;
    color: #c0392b;
}

.asc-button-link {
    background: none;
    border: none;
    padding: 4px 8px;
    font-size: 13px;
    text-decoration: underline;
}

.asc-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   Animal Entries
   ========================================================================== */

.animal-entry {
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    background: #fafbfc;
    position: relative;
}

.animal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e1e1e1;
}

.animal-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 16px;
}

.animal-number {
    background: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: normal;
}

.remove-animal-btn {
    position: absolute;
    top: 12px;
    right: 12px;
}

/* ==========================================================================
   Additional Services
   ========================================================================== */

.additional-services-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
}

.additional-services-section h5 {
    margin: 0 0 16px 0;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
}

.additional-services-section .asc-checkbox-group {
    gap: 8px;
}

.additional-services-section .asc-checkbox-option {
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: normal;
    color: #2c3e50;
    border: 1px solid #e1e1e1;
    background: #fafbfc;
}

.additional-services-section .asc-checkbox-option:hover {
    background-color: #f0f4f8;
    border-color: #3498db;
}

.additional-services-section .asc-checkbox-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 1px;
}

/* ==========================================================================
   Medication Entries
   ========================================================================== */

.medications-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
}

.medications-section h5 {
    margin: 0 0 16px 0;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
}

.medication-entry {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
}

.medication-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.medication-header h6 {
    margin: 0;
    font-size: 14px;
    color: #2c3e50;
}

.multiple-frequency-options,
.custom-frequency-options,
.limited-duration-options {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #3498db;
}

.duration-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ==========================================================================
   Autocomplete
   ========================================================================== */

.autocomplete-results {
    position: relative;
    background: white;
    border: 1px solid #e1e1e1;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-results.show {
    display: block;
}

.autocomplete-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
    transition: background-color 0.2s ease;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #e3f2fd;
}

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

.autocomplete-item .animal-name {
    font-weight: 500;
    color: #2c3e50;
}

.autocomplete-item .animal-details {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

/* ==========================================================================
   Cost Estimate
   ========================================================================== */

.asc-cost-estimate {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.asc-cost-estimate h4 {
    margin: 0 0 16px 0;
    color: white;
}

.cost-breakdown {
    margin-bottom: 16px;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

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

.cost-description {
    font-size: 14px;
}

.cost-amount {
    font-weight: 600;
    font-size: 14px;
}

.total-cost {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin-top: 16px;
}

/* ==========================================================================
   Form Messages
   ========================================================================== */

.asc-form-messages {
    margin-top: 16px;
}

.asc-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 14px;
}

.asc-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.asc-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.asc-message.info {
    background: #cce7ff;
    color: #004085;
    border: 1px solid #b3d7ff;
}

/* ==========================================================================
   Form Submit
   ========================================================================== */

.asc-form-submit {
    text-align: center;
    padding: 24px 0;
    border-top: 1px solid #e1e1e1;
    margin-top: 24px;
}

.asc-form-submit .asc-button {
    min-width: 200px;
    font-size: 16px;
    padding: 14px 32px;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.asc-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.asc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: asc-spin 1s linear infinite;
}

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

.asc-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: asc-spin 1s ease-in-out infinite;
    margin-right: 8px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .asc-boarding-form {
        margin: 0 16px;
    }
    
    .asc-form-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .asc-form-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .animal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .remove-animal-btn {
        position: static;
        align-self: flex-end;
    }
    
    .medication-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .asc-radio-group,
    .asc-checkbox-group {
        gap: 12px;
    }
    
    /* Mobile boarding type styling */
    .asc-radio-group .asc-radio-option {
        padding: 14px 16px;
        min-height: 70px;
    }
    
    .asc-radio-group .asc-radio-option input[type="radio"] {
        top: 14px;
        left: 14px;
    }
    
    .asc-radio-group .radio-label {
        margin-left: 28px;
    }
    
    .additional-services-section .asc-checkbox-option {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .asc-form-submit .asc-button {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .asc-form-section {
        padding: 12px;
    }
    
    .asc-form-section legend {
        font-size: 16px;
        padding: 0 8px;
    }
    
    .animal-entry {
        padding: 16px;
    }
    
    .medication-entry {
        padding: 12px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.asc-form-field input:focus,
.asc-form-field select:focus,
.asc-form-field textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.asc-button:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .asc-boarding-form {
        color: black;
        background: white;
    }
    
    .asc-form-section {
        border: 1px solid #000;
        box-shadow: none;
        background: white;
        page-break-inside: avoid;
    }
    
    .asc-button,
    .remove-animal-btn,
    .remove-medication-btn,
    .add-animal-btn,
    .add-medication-btn {
        display: none;
    }
    
    .asc-form-submit {
        display: none;
    }
}