/* ============================================
   Customization Modal Styles
   ============================================ */
.customization-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.customization-modal.active {
    display: flex;
}

.customization-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.customization-modal-content {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 1.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: 10001;
    animation: modalSlideIn 0.3s ease;
    border: 2px solid rgba(18, 84, 57, 0.1);
}

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

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.customization-modal-header {
    padding: 2rem 2rem 1.5rem;
    border-bottom: 2px solid rgba(18, 84, 57, 0.1);
    background: linear-gradient(135deg, #125439 0%, #406757 100%);
    border-radius: 1.5rem 1.5rem 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header-content {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
}

.modal-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.modal-title-section h2 {
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.modal-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    margin: 0;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

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

/* Modal Body */
.customization-modal-body {
    padding: 2.5rem;
    overflow-y: auto;
    flex: 1;
    max-height: calc(90vh - 200px);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

/* Progress Indicator */
.modal-progress-indicator {
    padding: 1.5rem 2rem;
    background: rgba(18, 84, 57, 0.03);
    border-bottom: 2px solid rgba(18, 84, 57, 0.1);
}

.progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    position: relative;
}

.progress-step .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    border: 3px solid #e0e0e0;
}

.progress-step.active .step-number {
    background: linear-gradient(135deg, #125439, #406757);
    color: white;
    border-color: #125439;
    box-shadow: 0 4px 15px rgba(18, 84, 57, 0.3);
    transform: scale(1.1);
}

.progress-step.completed .step-number {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.progress-step.completed .step-number::after {
    content: '✓';
    font-size: 1.2rem;
}

.progress-step .step-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    text-align: center;
}

.progress-step.active .step-label {
    color: #125439;
    font-weight: 700;
}

.progress-line {
    flex: 1;
    height: 3px;
    background: #e0e0e0;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    max-width: 100px;
}

.progress-line::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #125439, #406757);
    transition: width 0.5s ease;
}

.progress-step.active ~ .progress-step .progress-line::after,
.progress-step.completed ~ .progress-step .progress-line::after {
    width: 100%;
}

/* Loading Overlay */
.modal-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.5rem;
}

.loading-spinner-wrapper {
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(18, 84, 57, 0.1);
    border-top-color: #125439;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-message {
    color: #125439;
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0;
}

/* Form Loading Skeleton */
.form-loading-skeleton {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.skeleton-field {
    height: 80px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 0.75rem;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Step Content */
.step-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.step-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(18, 84, 57, 0.1);
}

.step-header h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #125439;
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.step-header h3 i {
    font-size: 1.5rem;
    color: #406757;
}

.step-header p {
    color: #666;
    font-size: 1.05rem;
    margin: 0;
}

/* File Types Grid */
.file-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.file-type-card {
    background: white;
    border: 2px solid rgba(18, 84, 57, 0.15);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.file-type-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #125439, #406757);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.file-type-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(18, 84, 57, 0.15);
    border-color: #125439;
}

.file-type-card:hover::before {
    transform: scaleX(1);
}

.file-type-card.selected {
    border-color: #125439;
    background: linear-gradient(135deg, rgba(18, 84, 57, 0.05), rgba(64, 103, 87, 0.05));
    box-shadow: 0 8px 25px rgba(18, 84, 57, 0.2);
}

.file-type-card.selected::before {
    transform: scaleX(1);
}

.file-type-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #125439, #406757);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    transition: all 0.3s ease;
}

.file-type-card:hover .file-type-icon {
    transform: scale(1.1) rotate(5deg);
}

.file-type-card.selected .file-type-icon {
    background: linear-gradient(135deg, #406757, #125439);
    box-shadow: 0 4px 15px rgba(18, 84, 57, 0.3);
}

.file-type-card h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #125439;
    margin: 0 0 0.5rem 0;
}

.file-type-card p {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
}

/* Form Fields */
.customization-form-fields {
    max-width: 600px;
    margin: 0 auto;
}

.form-row {
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group {
    position: relative;
}

.form-group label {
    font-weight: 700;
    color: #125439;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group label .field-icon {
    font-size: 1rem;
    color: #406757;
}

.form-group label .required {
    color: #dc3545;
    margin-right: 0.25rem;
    font-size: 1.2rem;
}

.form-group .field-tooltip {
    position: relative;
    display: inline-block;
    margin-right: 0.5rem;
    cursor: help;
}

.form-group .field-tooltip .tooltip-icon {
    color: #666;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.form-group .field-tooltip:hover .tooltip-icon {
    color: #125439;
}

.form-group .field-tooltip .tooltip-content {
    position: absolute;
    bottom: 100%;
    right: 50%;
    transform: translateX(50%);
    margin-bottom: 0.5rem;
    padding: 0.75rem 1rem;
    background: #333;
    color: white;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    max-width: 250px;
    white-space: normal;
    text-align: center;
}

.form-group .field-tooltip .tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 50%;
    transform: translateX(50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.form-group .field-tooltip:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
}

.form-group .field-example {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
    font-style: italic;
    padding-right: 0.5rem;
}

.form-group .field-error {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-right: 0.5rem;
}

.form-group .field-error::before {
    content: '⚠';
    font-size: 1rem;
}

.form-group .field-success {
    color: #28a745;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-right: 0.5rem;
}

.form-group .field-success::before {
    content: '✓';
    font-size: 1rem;
}

.form-group .char-counter {
    font-size: 0.8rem;
    color: #666;
    text-align: left;
    margin-top: 0.25rem;
    padding-right: 0.5rem;
}

.form-group .char-counter.warning {
    color: #ff9800;
}

.form-group .char-counter.error {
    color: #dc3545;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 2px solid rgba(18, 84, 57, 0.2);
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    color: #333;
    font-family: 'Cairo', sans-serif;
    position: relative;
}

.form-control:focus {
    outline: none;
    border-color: #125439;
    box-shadow: 0 0 0 3px rgba(18, 84, 57, 0.1);
    transform: translateY(-1px);
}

.form-control:hover:not(:disabled) {
    border-color: rgba(18, 84, 57, 0.4);
}

.form-control:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

.form-control.valid {
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%2328a745' d='M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    padding-left: 2.5rem;
}

.form-control.invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23dc3545' d='M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z'/%3E%3Cpath fill='%23dc3545' d='M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    padding-left: 2.5rem;
}

.form-control.error {
    border-color: #dc3545;
    animation: shake 0.3s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.form-control option {
    padding: 0.5rem;
}

/* Review Summary */
.review-summary {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 2px solid rgba(18, 84, 57, 0.1);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.review-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(18, 84, 57, 0.1);
}

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

.review-label {
    font-weight: 600;
    color: #125439;
    font-size: 0.95rem;
}

.review-value {
    color: #333;
    font-weight: 500;
    text-align: left;
    flex: 1;
    margin-right: 1rem;
}

/* Modal Footer */
.customization-modal-footer {
    padding: 1.5rem 2rem;
    border-top: 2px solid rgba(18, 84, 57, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: rgba(18, 84, 57, 0.02);
    border-radius: 0 0 1.5rem 1.5rem;
}

.customization-modal-footer .btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-width: 120px;
    justify-content: center;
}

.customization-modal-footer .btn:focus {
    outline: 3px solid rgba(18, 84, 57, 0.3);
    outline-offset: 2px;
}

.customization-modal-footer .btn:active {
    transform: translateY(1px);
}

.customization-modal-footer .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.customization-modal-footer .btn.loading {
    pointer-events: none;
}

.customization-modal-footer .btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}

.customization-modal-footer .btn-primary {
    background: linear-gradient(135deg, #125439, #406757);
    color: white;
}

.customization-modal-footer .btn-primary:hover {
    background: linear-gradient(135deg, #406757, #125439);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(18, 84, 57, 0.3);
}

.customization-modal-footer .btn-secondary {
    background: white;
    color: #125439;
    border: 2px solid #125439;
}

.customization-modal-footer .btn-secondary:hover {
    background: #125439;
    color: white;
}

.customization-modal-footer .btn-success {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
}

.customization-modal-footer .btn-success:hover {
    background: linear-gradient(135deg, #128C7E, #25D366);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .customization-modal-content {
        max-width: 95%;
        max-height: 95vh;
    }

    .customization-modal-header {
        padding: 1.5rem 1rem 1rem;
    }

    .modal-header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .modal-title-section h2 {
        font-size: 1.5rem;
    }

    .modal-close-btn {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }

    .modal-progress-indicator {
        padding: 1rem;
    }

    .progress-step .step-number {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .progress-step .step-label {
        font-size: 0.75rem;
    }

    .progress-line {
        max-width: 60px;
    }

    .customization-modal-body {
        padding: 1.5rem 1rem;
    }

    .form-group label {
        font-size: 1rem;
    }

    .form-control {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }


    .file-types-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .file-type-card {
        padding: 1.25rem;
    }

    .file-type-icon {
        width: 60px;
        height: 60px;
        font-size: 1.75rem;
    }

    .customization-modal-footer {
        flex-direction: column;
        padding: 1rem;
    }

    .customization-modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    .review-summary {
        padding: 1.5rem;
    }

    .review-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .review-value {
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    .step-header h3 {
        font-size: 1.5rem;
    }

    .step-header {
        margin-bottom: 2rem;
        padding-bottom: 1rem;
    }
}