/* ===========================================
   MODAL MULTI-STEP - Styles
   =========================================== */

/* Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal-overlay.closing {
    opacity: 0;
}

/* Container */
.modal-container {
    background: #fff;
    width: 70%;
    max-width: 900px;
    height: 90%;
    max-height: 850px;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

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

/* Header */
.modal-header {
    background: linear-gradient(135deg, #522700 0%, #402000 100%);
    color: #fff;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header-content {
    flex: 1;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
}

.modal-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin: 4px 0 0;
}

.modal-close {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Progress Steps */
.modal-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.progress-step.active .step-number,
.progress-step.completed .step-number {
    background: #FF7F00;
    color: #fff;
}

.progress-step.completed .step-number {
    background: #10b981;
}

.step-label {
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
    text-align: center;
}

.progress-step.active .step-label {
    color: #FF7F00;
    font-weight: 600;
}

.progress-step.completed .step-label {
    color: #10b981;
}

.progress-line {
    width: 60px;
    height: 3px;
    background: #e5e7eb;
    margin: 0 8px;
    margin-bottom: 20px;
    border-radius: 2px;
    transition: background 0.3s ease;
}

.progress-line.active {
    background: #FF7F00;
}

.progress-line.completed {
    background: #10b981;
}

/* Test Mode Banner */
.test-mode-banner {
    padding: 8px 24px;
    background: #fef3c7;
    border-bottom: 1px solid #fcd34d;
    text-align: center;
}

.test-mode-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.test-mode-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Form Content */
.modal-form {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Form Steps */
.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.step-title {
    font-size: 18px;
    font-weight: 600;
    color: #522700;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #FF7F00;
}

/* Form Grid */
.form-grid {
    margin-bottom: 16px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Form Groups */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-label .required {
    color: #ef4444;
}

/* Tooltips */
.label-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #e5e7eb;
    border-radius: 50%;
    cursor: help;
    font-size: 10px;
    color: #6b7280;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.label-tooltip:hover {
    background: #FF7F00;
    color: #fff;
}

.label-tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    width: max-content;
    max-width: 250px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.label-tooltip::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.label-tooltip:hover::before,
.label-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Tooltip position adjustments for edge cases */
.label-tooltip.tooltip-left::before {
    left: 0;
    transform: translateX(0);
}

.label-tooltip.tooltip-left::after {
    left: 8px;
    transform: translateX(0);
}

.label-tooltip.tooltip-right::before {
    left: auto;
    right: 0;
    transform: translateX(0);
}

.label-tooltip.tooltip-right::after {
    left: auto;
    right: 8px;
    transform: translateX(0);
}

/* Inputs */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #374151;
    transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #FF7F00;
    box-shadow: 0 0 0 3px rgba(255, 127, 0, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #9ca3af;
}

.form-textarea {
    resize: vertical;
    min-height: 70px;
    border-radius: 8px;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Radio & Checkbox */
.radio-group,
.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.radio-option,
.checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 13px;
    background: #ffffff;
    color: #374151;
}

.radio-option:hover,
.checkbox-option:hover {
    border-color: #FF7F00;
    background: #fff;
    box-shadow: 0 2px 8px rgba(255, 127, 0, 0.1);
}

.radio-option input,
.checkbox-option input {
    accent-color: #FF7F00;
    width: 18px;
    height: 18px;
}

.radio-option input:checked + span,
.checkbox-option input:checked + span {
    color: #FF7F00;
    font-weight: 500;
}

/* Selected state for radio and checkbox options */
.radio-option:has(input:checked),
.checkbox-option:has(input:checked) {
    border-color: #FF7F00;
    background: #fff;
    box-shadow: 0 2px 8px rgba(255, 127, 0, 0.15);
}

.checkbox-option.highlight {
    background: #fff;
    border-color: #fcd34d;
    padding: 12px 16px;
}

.checkbox-option.highlight:has(input:checked) {
    border-color: #FF7F00;
    background: #fff;
}

/* Sections */
.form-section-toggle {
    margin: 20px 0;
    padding: 12px 16px;
    background: #f3f4f6;
    border-radius: 8px;
}

.pro-section,
.publication-section {
    margin-top: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.hidden {
    display: none !important;
}

/* Info Box */
.info-box {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #1e40af;
}

/* Footer */
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.btn-prev,
.btn-next,
.btn-submit,
.btn-close-final {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-prev {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-prev:hover {
    background: #f3f4f6;
}

.btn-next {
    background: linear-gradient(135deg, #FF7F00 0%, #e67300 100%);
    color: #fff;
    margin-left: auto;
}

.btn-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 127, 0, 0.4);
}

.btn-submit {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    margin-left: auto;
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-close-final {
    background: #522700;
    color: #fff;
    margin-left: auto;
}

.btn-close-final:hover {
    background: #402000;
}

/* Confirmation */
.confirmation-content {
    text-align: center;
    padding: 20px;
}

.confirmation-icon {
    margin-bottom: 20px;
}

.confirmation-title {
    font-size: 24px;
    font-weight: 600;
    color: #10b981;
    margin: 0 0 8px;
}

.confirmation-text {
    font-size: 15px;
    color: #6b7280;
    margin: 0 0 24px;
}

.confirmation-summary {
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px;
    margin: 20px auto;
    max-width: 500px;
    text-align: left;
}

.summary-grid {
    display: grid;
    gap: 12px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

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

.summary-label {
    font-size: 13px;
    color: #6b7280;
}

.summary-value {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.confirmation-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    font-size: 13px;
    color: #c2410c;
    max-width: 400px;
    margin: 0 auto;
}

/* Notification Toast */
.notification-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10001;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.notification-toast.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.notification-toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.notification-toast.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
    .form-input,
    .form-select,
    .form-textarea {
        padding: 10px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .radio-option,
    .checkbox-option {
        padding: 10px 14px;
        min-height: 44px;
    }

    .btn-prev,
    .btn-next,
    .btn-submit,
    .btn-close-final {
        padding: 16px 24px;
        min-height: 52px;
    }

    .modal-close {
        width: 48px;
        height: 48px;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .modal-container {
        width: 90%;
        height: 85%;
    }
}

@media (max-width: 768px) {
    .modal-overlay {
        align-items: flex-end;
    }

    .modal-container {
        width: 100%;
        height: 95%;
        max-height: none;
        border-radius: 20px 20px 0 0;
        animation: modalSlideUp 0.3s ease;
    }

    @keyframes modalSlideUp {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-title {
        font-size: 17px;
    }

    .modal-subtitle {
        font-size: 12px;
    }

    .modal-progress {
        padding: 12px 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .modal-progress::-webkit-scrollbar {
        display: none;
    }

    .progress-step {
        min-width: 50px;
    }

    .step-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .progress-line {
        width: 20px;
        min-width: 20px;
    }

    .step-label {
        font-size: 9px;
        max-width: 55px;
        white-space: nowrap;
    }

    .test-mode-banner {
        padding: 10px 16px;
    }

    .test-mode-btn {
        width: 100%;
        padding: 12px 16px;
    }

    .modal-form {
        padding: 20px 16px;
    }

    .step-title {
        font-size: 16px;
        margin-bottom: 16px;
    }

    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

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

    .form-group {
        margin-bottom: 14px;
    }

    .form-label {
        font-size: 14px;
        margin-bottom: 8px;
        flex-wrap: wrap;
    }

    /* Tooltips mobile */
    .label-tooltip {
        width: 18px;
        height: 18px;
    }

    .label-tooltip::before {
        max-width: 200px;
        font-size: 11px;
        padding: 6px 10px;
    }

    .form-input,
    .form-select,
    .form-textarea {
        padding: 10px 14px;
        font-size: 16px;
        border-radius: 8px;
    }

    .radio-group {
        flex-direction: row;
        width: 100%;
    }

    .radio-option {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
        border-radius: 8px;
    }

    .checkbox-option {
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 8px;
    }

    .checkbox-option.highlight {
        padding: 16px;
    }

    .info-box {
        padding: 14px 16px;
        font-size: 13px;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .info-box i {
        font-size: 20px;
    }

    .form-section-toggle {
        padding: 14px 16px;
        margin: 16px 0;
    }

    .pro-section,
    .publication-section {
        padding: 16px;
        margin-top: 12px;
    }

    .modal-footer {
        padding: 16px;
        flex-direction: column;
        gap: 12px;
        background: #fff;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    }

    .btn-prev,
    .btn-next,
    .btn-submit,
    .btn-close-final {
        width: 100%;
        justify-content: center;
        padding: 16px 24px;
        font-size: 15px;
        border-radius: 9999px;
    }

    .btn-prev {
        order: 2;
    }

    .btn-next,
    .btn-submit,
    .btn-close-final {
        order: 1;
        margin-left: 0;
    }

    /* Confirmation mobile */
    .confirmation-content {
        padding: 16px 8px;
    }

    .confirmation-icon i {
        font-size: 48px;
    }

    .confirmation-title {
        font-size: 20px;
    }

    .confirmation-text {
        font-size: 14px;
    }

    .confirmation-summary {
        padding: 16px;
        margin: 16px auto;
    }

    .summary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 10px 0;
    }

    .summary-label {
        font-size: 12px;
    }

    .summary-value {
        font-size: 14px;
    }

    .confirmation-notice {
        padding: 14px 16px;
        font-size: 12px;
        max-width: 100%;
        text-align: center;
        flex-direction: column;
        gap: 6px;
    }

    /* Notification mobile */
    .notification-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        border-radius: 12px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .modal-form {
        padding: 16px 12px;
    }

    .step-label {
        display: none;
    }

    .progress-step {
        min-width: 32px;
    }

    .progress-line {
        width: 16px;
        margin: 0 4px;
        margin-bottom: 0;
    }
}
