/* Generic Modal Styles - Reusable across the application */

/* Base modal overlay and container */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

/* Prevent body scrolling when modal is open */
body.modal-open {
    overflow: hidden;
}

.modal-content {
    background-color: #ffffff;
    margin: 8% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    position: relative;
    animation: modalopen 0.3s ease-out;
    overflow: hidden;
}

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

/* Modal header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px 24px;
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #0066cc;
    border-bottom: 2px solid #0055aa;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.25);
    color: #ffffff;
}

.modal-header h3 {
    margin: 0;
    color: #ffffff;
    border-bottom: none;
    padding-bottom: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Modal close button */
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #ffffff;
    opacity: 0.9;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: #ffffff;
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.modal-close:active {
    transform: scale(0.95);
}

/* Modal body */
.modal-body {
    padding: 24px;
}

/* Modal actions/buttons */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.modal-actions .btn {
    min-width: 100px;
    font-weight: 500;
}


/* Legacy modal button styles (for compatibility) */
.modal-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.modal-hint {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
    margin-bottom: 15px;
}

/* Legacy modal close button styles (for compatibility) */
.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #888;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
    color: #000;
    text-decoration: none;
}

.modal-close-alt {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-close-alt:hover {
    color: #333;
}

/* Modal-specific form styles */
.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    display: block;
}

/* Registration Details Modal Specific Styles */
.registration-details-modal {
    background-color: white;
    border-radius: 10px;
    padding: 16px;
}

/* Header with participant info and status */
.registration-details-modal .details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
}

.registration-details-modal .participant-info h4 {
    margin: 0 0 4px 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.registration-details-modal .age-info {
    color: #666;
    font-size: 0.9rem;
}

.registration-details-modal .birth-date {
    margin-bottom: 2px;
}

.registration-details-modal .age-display {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.registration-details-modal .current-age {
    color: #6c757d;
    font-size: 0.85rem;
}

.registration-details-modal .age-separator {
    color: #007bff;
    font-weight: bold;
    font-size: 0.9rem;
}

.registration-details-modal .event-age {
    color: #155724;
    font-weight: 600;
    background-color: #d4edda;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85rem;
}

.registration-details-modal .single-age {
    color: #495057;
    font-weight: 500;
}

/* Compact sections */
.registration-details-modal .compact-section {
    margin-bottom: 16px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.registration-details-modal .compact-section h5 {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 4px;
}

/* Two-column layout for side-by-side sections */
.registration-details-modal .compact-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

/* Contact information */
.registration-details-modal .contact-grid {
    display: grid;
    gap: 6px;
}

.registration-details-modal .contact-item {
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Checkbox list for IDs */
.registration-details-modal .checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.registration-details-modal .check-item {
    color: #155724;
    font-size: 0.85rem;
    line-height: 1.3;
}

.registration-details-modal .no-items {
    color: #6c757d;
    font-style: italic;
    font-size: 0.85rem;
}

/* Dietary information */
.registration-details-modal .dietary-info {
    display: grid;
    gap: 4px;
}

.registration-details-modal .dietary-item {
    font-size: 0.9rem;
    line-height: 1.3;
}

/* Permissions grid */
.registration-details-modal .permissions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.registration-details-modal .permission-item {
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: center;
    font-weight: 500;
}

.registration-details-modal .permission-item.permitted {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.registration-details-modal .permission-item.denied {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Compact signature */
.registration-details-modal .signature-container-small {
    text-align: center;
    margin: 8px 0;
}

.registration-details-modal .signature-image-small {
    max-width: 100%;
    max-height: 120px;
    border: 1px solid #ddd;
    padding: 8px;
    background-color: #ffffff;
    border-radius: 4px;
}

/* Footer information */
.registration-details-modal .registration-footer {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background-color: #e9ecef;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-top: 16px;
}

/* Legacy styles for backward compatibility */
.registration-details-modal .section-title {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.5rem;
    color: #2c3e50;
}

.registration-details-modal .details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 1.5rem;
}

.registration-details-modal .details-section {
    margin-bottom: 1.5rem;
}

.registration-details-modal .detail-item {
    margin-bottom: 0.8rem;
}

.registration-details-modal .detail-label {
    font-weight: bold;
    color: #555;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.registration-details-modal .detail-value {
    font-size: 1rem;
    color: #333;
}

.registration-details-modal .boolean-value {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85rem;
}

.registration-details-modal .boolean-true {
    background-color: #d4edda;
    color: #155724;
}

.registration-details-modal .boolean-false {
    background-color: #f8d7da;
    color: #721c24;
}

.registration-details-modal .signature-container {
    margin: 1.5rem 0;
    max-width: 100%;
    text-align: center;
}

.registration-details-modal .signature-image {
    max-width: 100%;
    max-height: 200px;
    border: 1px solid #ddd;
    padding: 10px;
    background-color: #f8f8f8;
    border-radius: 4px;
}

/* Status badge styles moved to /static/css/status-badges.css */

/* Enhanced modal content for registration details */
.registration-modal-content {
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden; /* Remove overflow from container */
    display: flex;
    flex-direction: column;
}

/* Make modal header sticky */
.registration-modal-content .modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #0066cc;
    border-bottom: 2px solid #0055aa;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.25);
    color: #ffffff;
}

.registration-modal-content .modal-header h3 {
    color: #ffffff;
    font-weight: 600;
}

.registration-modal-content .modal-header .modal-close {
    color: #ffffff;
    opacity: 0.9;
}

.registration-modal-content .modal-header .modal-close:hover {
    color: #ffffff;
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Make modal body scrollable */
.registration-modal-content .modal-body {
    overflow-y: auto;
    flex: 1;
    max-height: calc(85vh - 80px); /* Account for header height */
}

/* Utility classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: #6c757d;
}

/* Responsive design */
@media (max-width: 768px) {
    .modal-content {
        margin: 5% auto;
        width: 95%;
    }
    
    .modal-header {
        padding: 16px 20px 12px 20px;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .registration-details-modal .details-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .registration-modal-content {
        max-width: 95vw !important;
        max-height: 90vh !important;
        margin: 2% auto !important;
    }
    
    .registration-modal-content .modal-body {
        max-height: calc(90vh - 70px); /* Adjust for smaller mobile header */
    }
    
    .registration-details-modal .section-title {
        font-size: 1.1rem;
    }
    
    .registration-details-modal .detail-label {
        font-size: 0.85rem;
    }
    
    .registration-details-modal .detail-value {
        font-size: 0.9rem;
    }
    
    /* Compact layout mobile adjustments */
    .registration-details-modal .compact-two-column {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .registration-details-modal .details-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .registration-details-modal .permissions-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .registration-details-modal .registration-footer {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }
    
    .registration-details-modal .age-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .registration-details-modal .age-separator {
        display: none;
    }
}

@media (max-width: 480px) {
    .modal-content {
        margin: 2% auto;
        width: 98%;
    }
    
    .modal-header {
        padding: 12px 16px 8px 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-actions .btn {
        width: 100%;
        min-width: auto;
    }
}

/* Registration Edit Mode Styles */

/* Participant header with edit icon */
.participant-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.edit-icon-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.edit-icon-btn:hover {
    background-color: #f8f9fa;
    color: #007bff;
    transform: scale(1.1);
}

.edit-icon-btn:active {
    transform: scale(0.95);
}

.edit-icon-btn svg {
    width: 16px;
    height: 16px;
}

/* Edit action buttons */
.btn-save, .btn-cancel {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-save {
    background-color: #28a745;
    color: white;
}

.btn-save:hover:not(:disabled) {
    background-color: #1e7e34;
    transform: translateY(-1px);
}

.btn-save:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

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

.btn-cancel:hover {
    background-color: #545b62;
    transform: translateY(-1px);
}

.edit-actions {
    display: flex;
    gap: 8px;
}

/* Edit Form Styles */
.edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
}

.edit-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
}

.edit-section {
    margin-bottom: 24px;
    padding: 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.edit-section h5 {
    margin: 0 0 16px 0;
    color: #495057;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 8px;
}

.edit-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.edit-row:last-child {
    margin-bottom: 0;
}

.edit-field {
    display: flex;
    flex-direction: column;
}

.edit-field label {
    margin-bottom: 4px;
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
}

.edit-field input,
.edit-field select,
.edit-field textarea {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.edit-field input:focus,
.edit-field select:focus,
.edit-field textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.edit-field input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    transform: scale(1.1);
}

.edit-field input[type="checkbox"] + label {
    flex-direction: row;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.checkbox-grid .edit-field {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.checkbox-grid .edit-field:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.checkbox-grid .edit-field input[type="checkbox"] {
    margin: 0;
    transform: scale(1.1);
}

.checkbox-grid .edit-field label {
    margin: 0;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Compact checkbox grids for specific sections */
.checkbox-grid-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 6px;
}

.checkbox-grid-compact .edit-field {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.checkbox-grid-compact .edit-field:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.checkbox-grid-compact .edit-field input[type="checkbox"] {
    margin: 0;
    transform: scale(1.0);
}

.checkbox-grid-compact .edit-field label {
    margin: 0;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1.2;
}

/* Radio group styling */
.radio-group {
    display: flex;
    flex-direction: row;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.radio-option:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.radio-option input[type="radio"]:checked + label {
    color: #007bff;
    font-weight: 500;
}

.radio-option input[type="radio"] {
    margin: 0;
    transform: scale(1.0);
}

.radio-option label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
    font-size: 0.85rem;
    line-height: 1.2;
}

/* Single column for certain fields */
.edit-row.single-column {
    grid-template-columns: 1fr;
}

/* Conditional field visibility */
#additionalContactFields,
#disabilityFields,
#allergyFields,
#addAdditionalContactFields,
#addDisabilityFields,
#addAllergyFields {
    margin-top: 12px;
    padding: 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

/* Compact edit sections for specific use cases */
.edit-section.compact {
    margin-bottom: 16px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.edit-section.compact h5 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 0.9rem;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 6px;
}

/* Inline checkbox styling for toggles */
.inline-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.inline-checkbox:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.inline-checkbox input[type="checkbox"] {
    margin: 0;
    transform: scale(1.1);
}

.inline-checkbox label {
    margin: 0;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Responsive adjustments for edit mode */
@media (max-width: 768px) {
    .modal-actions {
        padding: 0 20px;
        flex-direction: column;
    }
    
    .edit-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .edit-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .checkbox-grid, .checkbox-grid-compact {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .edit-section {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .btn-edit, .btn-save, .btn-cancel {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .modal-actions {
        padding: 0 16px;
    }
    
    .edit-field input,
    .edit-field select,
    .edit-field textarea {
        padding: 10px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .edit-header h4 {
        font-size: 1.1rem;
    }
    
    .edit-section h5 {
        font-size: 0.95rem;
    }
}

/* Add Registration Button Styles */
.registration-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.registration-stats-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-add-registration, .btn-add-registration-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-add-registration:hover, .btn-add-registration-primary:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.btn-add-registration:active, .btn-add-registration-primary:active {
    transform: translateY(0);
}

.btn-add-registration svg, .btn-add-registration-primary svg {
    width: 16px;
    height: 16px;
}

.btn-add-registration-primary {
    padding: 12px 20px;
    font-size: 1rem;
    margin-top: 16px;
}

/* Required field indicator */
.required {
    color: #dc3545;
    font-weight: bold;
}

/* Add registration actions */
.add-registration-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

/* No items section styling */
.no-items {
    text-align: center;
    padding: 40px 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.no-items h3 {
    color: #6c757d;
    margin-bottom: 8px;
}

.no-items p {
    color: #6c757d;
    margin-bottom: 16px;
}