/* ===========================
   Modal Styles
   =========================== */

/* Modal Overlay */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal Content */
.modal-content {
    background: #ffffff;
    border-radius: 24px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 3rem;
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Close Button */
.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: #f3f4f6;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.modal-close:hover {
    background: #ef4444;
    color: #ffffff;
    transform: rotate(90deg);
}

/* Progress Bar */
.modal-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    position: relative;
}

.modal-progress::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e5e7eb;
    z-index: 0;
}

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

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.progress-step.active .step-circle {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.progress-step.completed .step-circle {
    background: #10b981;
    color: #ffffff;
}

.progress-step span {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
}

.progress-step.active span {
    color: #2563EB;
    font-weight: 600;
}

/* Modal Steps */
.modal-step {
    display: none;
    animation: fadeInStep 0.4s ease;
}

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

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

.modal-step h2 {
    font-size: 2rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.modal-subtitle {
    color: #6b7280;
    font-size: 1.05rem;
    margin-bottom: 2rem;
}

/* Option Grid (Step 1) */
.option-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.option-card {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-card:hover {
    border-color: #3B82F6;
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.15);
}

.option-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 1.2rem;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #2563EB;
    transition: all 0.3s ease;
}

.option-card:hover .option-icon {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: #ffffff;
    transform: scale(1.1);
}

.option-card h3 {
    font-size: 1.2rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.option-card p {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Service Selection Grid (Step 2) */
.service-select-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.service-select-card {
    position: relative;
    cursor: pointer;
}

.service-select-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.service-card-inner {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.service-card-inner i {
    font-size: 2rem;
    color: #2563EB;
    transition: all 0.3s ease;
}

.service-card-inner span {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.service-select-card input[type="radio"]:checked + .service-card-inner {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    border-color: #2563EB;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

.service-select-card input[type="radio"]:checked + .service-card-inner i,
.service-select-card input[type="radio"]:checked + .service-card-inner span {
    color: #ffffff;
}

.service-select-card:hover .service-card-inner {
    border-color: #3B82F6;
    transform: translateY(-2px);
}

/* Form Styles (Step 3) */
.modal-form {
    margin-top: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.form-group label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.required {
    color: #ef4444;
}

.form-group input,
.form-group textarea {
    padding: 0.85rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Analyzer Modal */
.analyzer-modal {
    max-width: 1000px;
}

.analyzer-header {
    text-align: center;
    margin-bottom: 2rem;
}

.analyzer-header h2 {
    font-size: 2rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.analyzer-header p {
    color: #6b7280;
    font-size: 1.05rem;
}

.analyzer-input {
    margin-bottom: 2rem;
}

.url-input-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.url-input-wrapper:focus-within {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.url-input-wrapper i {
    color: #6b7280;
    font-size: 1.2rem;
    margin-left: 0.5rem;
}

.url-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.85rem;
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
}

.url-input-wrapper input:focus {
    outline: none;
}

/* Analyzer Results */
.analyzer-results {
    margin-top: 2rem;
}

.analyzer-results.hidden {
    display: none;
}

.loading-state {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid #e5e7eb;
    border-top-color: #3B82F6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-state p {
    color: #6b7280;
    font-size: 1.05rem;
}

.hidden {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        padding: 2rem 1.5rem;
        max-width: 95%;
    }

    .option-grid {
        grid-template-columns: 1fr;
    }

    .service-select-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-progress {
        margin-bottom: 2rem;
    }

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

    .step-circle {
        width: 35px;
        height: 35px;
    }

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

    .modal-subtitle {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .service-select-grid {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

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