/**
 * Congress Registration Form - Frontend Styles
 * Mobile-first responsive design
 */

/* ===========================
   CSS Variables
   =========================== */
:root {
    --crf-primary: #bf0d0d;
    --crf-primary-dark: #9a0a0a;
    --crf-success: #10b981;
    --crf-error: #ef4444;
    --crf-warning: #f59e0b;
    --crf-gray-50: #f9fafb;
    --crf-gray-100: #f3f4f6;
    --crf-gray-200: #e5e7eb;
    --crf-gray-300: #d1d5db;
    --crf-gray-400: #9ca3af;
    --crf-gray-500: #6b7280;
    --crf-gray-700: #374151;
    --crf-gray-900: #111827;
    --crf-border-radius: 8px;
    --crf-box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --crf-box-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* ===========================
   Container & Main Layout
   =========================== */
.crf-registration-form {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--crf-gray-900);
}

.crf-registration-form h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--crf-gray-900);
    margin: 0 0 1.5rem 0;
    text-align: center;
}

/* ===========================
   Congress Info
   =========================== */
.crf-congress-info {
    background: var(--crf-gray-50);
    border-left: 4px solid var(--crf-primary);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: var(--crf-border-radius);
}

.crf-address {
    margin: 0;
    font-size: 0.95rem;
    color: var(--crf-gray-700);
}

.crf-address a {
    color: var(--crf-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.crf-address a:hover {
    color: var(--crf-primary-dark);
    text-decoration: underline;
}

/* ===========================
   Form Sections
   =========================== */
.crf-form {
    background: #fff;
}

.crf-section {
    background: #fff;
    border: 1px solid var(--crf-gray-200);
    border-radius: var(--crf-border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--crf-box-shadow);
}

.crf-section h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--crf-gray-900);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--crf-gray-200);
}

/* ===========================
   Form Fields
   =========================== */
.crf-field {
    margin-bottom: 1.25rem;
}

.crf-field:last-child {
    margin-bottom: 0;
}

.crf-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--crf-gray-700);
}

.crf-field input[type="text"],
.crf-field input[type="email"],
.crf-field input[type="tel"],
.crf-field input[type="number"],
.crf-field select,
.crf-field textarea {
    width: 100%;
    max-width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid var(--crf-gray-300);
    border-radius: var(--crf-border-radius);
    font-size: 16px;
    line-height: 24px;
    min-height: 56px;
    height: auto;
    transition: all 0.2s;
    background: #fff;
    color: var(--crf-gray-900);
    box-sizing: border-box;
}

/* Make sure select text is visible - FORCE IT */
#crf-currency,
select#crf-currency,
.crf-field select#crf-currency,
.crf-field select {
    -webkit-appearance: menulist !important;
    -moz-appearance: menulist !important;
    appearance: menulist !important;
    color: #000000 !important;
    font-weight: 700 !important;
    background-color: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
    font-size: 16px !important;
    line-height: 24px !important;
    min-height: 56px !important;
    height: auto !important;
    text-indent: 0 !important;
    text-align: left !important;
    vertical-align: middle !important;
    -webkit-text-fill-color: #000000 !important;
}

#crf-currency option,
select#crf-currency option,
.crf-field select option {
    color: #000000 !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    font-weight: 600 !important;
    opacity: 1 !important;
    visibility: visible !important;
    -webkit-text-fill-color: #000000 !important;
}

/* Fix number input width */
.crf-field input[type="number"] {
    max-width: 100%;
    box-sizing: border-box;
    -moz-appearance: textfield;
}

/* Remove spinner arrows from number input */
.crf-field input[type="number"]::-webkit-outer-spin-button,
.crf-field input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.crf-field input:focus,
.crf-field select:focus,
.crf-field textarea:focus {
    outline: none;
    border-color: var(--crf-primary);
    box-shadow: 0 0 0 3px rgba(191, 13, 13, 0.1);
}

.crf-field input::placeholder {
    color: var(--crf-gray-400);
}

/* Checkbox & Radio Styles */
.crf-field input[type="checkbox"],
.crf-field input[type="radio"] {
    margin-right: 0.5rem;
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

.crf-field label:has(input[type="checkbox"]),
.crf-field label:has(input[type="radio"]) {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 400;
}

/* ===========================
   Total Price Display
   =========================== */
.crf-total-price {
    background: var(--crf-gray-50);
    border: 2px solid var(--crf-primary);
    border-radius: var(--crf-border-radius);
    padding: 1.25rem;
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.crf-total-price strong {
    font-size: 1.125rem;
    color: var(--crf-gray-900);
}

#crf-total-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--crf-primary);
}

/* ===========================
   Customer Fields
   =========================== */
.crf-customer-item {
    background: var(--crf-gray-50);
    border: 1px solid var(--crf-gray-200);
    border-radius: var(--crf-border-radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    position: relative;
}

.crf-customer-item h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--crf-primary);
}

.crf-customer-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .crf-customer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .crf-field-full {
        grid-column: 1 / -1;
    }
}

/* ===========================
   Company Fields Toggle
   =========================== */
#crf-company-fields {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--crf-gray-200);
}

#crf-company-fields .crf-field {
    margin-bottom: 1rem;
}

/* Grid for address fields */
.crf-address-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .crf-address-grid {
        grid-template-columns: 2fr 1fr;
    }
}

/* ===========================
   Payment Method
   =========================== */
.crf-payment .crf-field label {
    padding: 0.75rem 1rem;
    border: 2px solid var(--crf-gray-200);
    border-radius: var(--crf-border-radius);
    margin-bottom: 0.75rem;
    transition: all 0.2s;
    background: #fff;
}

.crf-payment .crf-field label:hover {
    border-color: var(--crf-primary);
    background: var(--crf-gray-50);
}

.crf-payment .crf-field:has(input:checked) label {
    border-color: var(--crf-primary);
    background: rgba(191, 13, 13, 0.05);
}

/* ===========================
   Terms & Privacy
   =========================== */
.crf-terms {
    background: var(--crf-gray-50);
}

.crf-terms .crf-field label {
    font-size: 0.9rem;
    color: var(--crf-gray-700);
}

/* ===========================
   Submit Button
   =========================== */
.crf-submit {
    margin-top: 2rem;
    text-align: center;
}

.crf-submit-btn {
    background: #bf0d0d !important;
    background-color: #bf0d0d !important;
    color: #fff !important;
    border: none !important;
    padding: 1rem 3rem !important;
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    border-radius: var(--crf-border-radius) !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    box-shadow: var(--crf-box-shadow) !important;
}

.crf-submit-btn:hover {
    background: #9a0a0a !important;
    background-color: #9a0a0a !important;
    box-shadow: var(--crf-box-shadow-lg) !important;
    transform: translateY(-1px) !important;
}

.crf-submit-btn:active {
    transform: translateY(0);
}

.crf-submit-btn:disabled {
    background: var(--crf-gray-400);
    cursor: not-allowed;
    transform: none;
}

/* Loading state */
.crf-submit-btn.loading {
    position: relative;
    color: transparent;
}

.crf-submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    top: 50%;
    left: 50%;
    margin-left: -0.625rem;
    margin-top: -0.625rem;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: crf-spinner 0.6s linear infinite;
}

@keyframes crf-spinner {
    to { transform: rotate(360deg); }
}

/* ===========================
   Messages
   =========================== */
.crf-message {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: var(--crf-border-radius);
    font-weight: 500;
}

.crf-message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--crf-success);
    color: #065f46;
}

.crf-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--crf-error);
    color: #991b1b;
}

.crf-message ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.25rem;
}

/* ===========================
   Field Errors
   =========================== */
.crf-field.error input,
.crf-field.error select,
.crf-field.error textarea {
    border-color: var(--crf-error);
}

.crf-field-error {
    color: var(--crf-error);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 639px) {
    .crf-registration-form {
        padding: 0 0.75rem;
    }

    .crf-section {
        padding: 1rem;
    }

    .crf-total-price {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .crf-submit-btn {
        width: 100%;
        padding: 1rem 1.5rem;
    }
}

@media (min-width: 768px) {
    .crf-registration-form h2 {
        font-size: 2.5rem;
    }
}

/* ===========================
   Accessibility
   =========================== */
.crf-field input:focus-visible,
.crf-field select:focus-visible,
.crf-field textarea:focus-visible {
    outline: 2px solid var(--crf-primary);
    outline-offset: 2px;
}

.crf-submit-btn:focus-visible {
    outline: 2px solid var(--crf-primary);
    outline-offset: 2px;
}

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

/* ===========================
   Congress Banner
   =========================== */
.crf-congress-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 1rem;
    max-height: 50px;
    width: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #D41119;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(212, 17, 25, 0.1);
    margin: 2rem auto;
    transition: all 0.3s ease;
}

.crf-congress-banner:hover {
    box-shadow: 0 3px 8px rgba(212, 17, 25, 0.15);
    transform: translateY(-1px);
}

.crf-banner-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.crf-banner-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0E2347;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crf-banner-action {
    flex-shrink: 0;
}

.crf-banner-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #D41119;
    color: #fff !important;
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 4px rgba(212, 17, 25, 0.2);
    white-space: nowrap;
}

.crf-banner-button:hover {
    background: #b30e15;
    transform: scale(1.02);
    box-shadow: 0 2px 6px rgba(212, 17, 25, 0.3);
}

.crf-banner-button:active {
    transform: scale(0.98);
}

/* Responsive design for banner */
@media (max-width: 768px) {
    .crf-congress-banner {
        width: 100%;
        flex-direction: row;
        padding: 0.5rem 0.75rem;
        gap: 0.75rem;
    }

    .crf-banner-content {
        flex-direction: row;
        text-align: left;
        gap: 0.5rem;
    }

    .crf-banner-title {
        font-size: 0.75rem;
    }

    .crf-banner-button {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
}