/* ========================================
   PROJECT MODAL - Enhanced CTA Flow
   ======================================== */


.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Overlay with Blur */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: -1; /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease, z-index 0s 0.4s; /* Delay z-index change */
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    z-index: 9900; /* Bring to front when active */
    transition: opacity 0.4s ease, visibility 0.4s ease, z-index 0s 0s; /* No delay for z-index when opening */
}

#modal-hexagon-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
}

/* Modal Container - Morphing Animation */
.project-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.1) !important;
    background: var(--card-bg);
    border: 2px solid rgba(0, 126, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 126, 255, 0.3);
    z-index: -1; /* Hidden by default */
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    opacity: 0;
    pointer-events: none; /* Don't block clicks when closed */
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.project-modal.active {
    transform: translate(-50%, -50%) scale(1) !important;
    opacity: 1;
    z-index: 9901; /* Bring to front when active */
    pointer-events: auto; /* Enable clicks when open */
}

/* Modal Header */
.modal-header {
    padding: 2rem 2.5rem;
    border-bottom: 1px solid rgba(0, 126, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 126, 255, 0.05) 0%, transparent 60%);
    z-index: 0;
}

.modal-header h2 {
    font-size: 1.8rem;
    color: var(--white);
    margin: 0;
    position: relative;
    z-index: 1;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 2;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
    transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
    padding: 2rem 2.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 130px);
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(0, 126, 255, 0.05);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 126, 255, 0.3);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 126, 255, 0.5);
}

/* Step Indicators */
.step-indicators {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.step-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 126, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid rgba(0, 126, 255, 0.3);
}

.step-indicator.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 126, 255, 0.6);
    transform: scale(1.1);
}

.step-indicator.completed {
    background: #27c93f;
    border-color: #27c93f;
}

.step-indicator.completed::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--white);
    font-size: 14px;
    font-weight: bold;
}

/* Modal Steps */
.modal-step {
    display: none;
    animation: fadeInSlide 0.5s ease forwards;
}

.modal-step.active {
    display: block;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Step Question */
.step-question {
    font-size: 1.4rem;
    color: var(--white);
    margin-bottom: 1.8rem;
    text-align: center;
    font-weight: 600;
    line-height: 1.4;
}

/* Option Cards (Step 1) */
.option-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.option-card {
    background: rgba(0, 126, 255, 0.05);
    border: 2px solid rgba(0, 126, 255, 0.2);
    border-radius: 15px;
    padding: 1.8rem 1.5rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-align: center;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.option-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 126, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.option-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 126, 255, 0.3);
    border-color: rgba(0, 126, 255, 0.4);
}

.option-card:hover::before {
    opacity: 1;
}

.option-card.selected {
    background: rgba(0, 126, 255, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 30px rgba(0, 126, 255, 0.4);
    animation: cardPulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.option-card h3 {
    font-size: 1.2rem;
    color: var(--white);
    margin-bottom: 0.6rem;
    position: relative;
    z-index: 1;
}

.option-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

/* Option Card Icons */
.option-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 1rem;
    color: var(--primary-color);
    opacity: 0.8;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.option-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 8px rgba(0, 126, 255, 0.3));
}

.option-card:hover .option-icon {
    transform: scale(1.1) translateY(-5px);
    opacity: 1;
}

.option-card.selected .option-icon {
    transform: scale(1.15) rotateY(360deg);
    opacity: 1;
    animation: iconSpin 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes iconSpin {
    0% {
        transform: scale(1) rotateY(0deg);
    }
    50% {
        transform: scale(1.2) rotateY(180deg);
    }
    100% {
        transform: scale(1.15) rotateY(360deg);
    }
}

/* Checkmark for Option Cards */
.option-card .checkmark {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 126, 255, 0.2);
    border: 2px solid rgba(0, 126, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.option-card.selected .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
    animation: checkmarkBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.option-card .checkmark::after {
    content: '✓';
    color: var(--white);
    font-size: 18px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0) rotate(-45deg);
    transition: all 0.3s ease;
}

.option-card.selected .checkmark::after {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

@keyframes checkmarkBounce {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

/* Service Cards (Step 1) */
.service-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.service-card-modal {
    background: rgba(0, 126, 255, 0.05);
    border: 2px solid rgba(0, 126, 255, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.service-card-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 126, 255, 0.1) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.service-card-modal:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 126, 255, 0.25);
    border-color: rgba(0, 126, 255, 0.4);
}

.service-card-modal:hover::before {
    opacity: 1;
}

.service-card-modal.selected {
    background: rgba(0, 126, 255, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 25px rgba(0, 126, 255, 0.35);
}

.service-card-modal .checkmark {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 126, 255, 0.2);
    border: 2px solid rgba(0, 126, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.service-card-modal.selected .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
    animation: checkmarkPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.service-card-modal .checkmark::after {
    content: '✓';
    color: var(--white);
    font-size: 16px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

.service-card-modal.selected .checkmark::after {
    opacity: 1;
    transform: scale(1);
}

@keyframes checkmarkPop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Service Card Icons */
.service-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    opacity: 0.8;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.service-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 8px rgba(0, 126, 255, 0.3));
}

.service-card-modal:hover .service-icon {
    transform: scale(1.1) translateY(-5px);
    opacity: 1;
}

.service-card-modal.selected .service-icon {
    transform: scale(1.15) rotateY(360deg);
    opacity: 1;
    animation: iconSpin 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.service-card-modal.selected {
    background: rgba(0, 126, 255, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 25px rgba(0, 126, 255, 0.35);
    animation: cardPulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.service-card-modal h4 {
    font-size: 1.05rem;
    color: var(--white);
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    width: 100%;
    text-align: center;
}

.service-card-modal p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
    position: relative;
    z-index: 1;
    width: 100%;
    text-align: center;
}

/* Form Elements (Step 2) */
.form-section {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    font-family: 'Courier New', monospace;
}

.timeline-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.timeline-option {
    background: rgba(0, 126, 255, 0.05);
    border: 2px solid rgba(0, 126, 255, 0.2);
    border-radius: 10px;
    padding: 0.9rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--white);
    font-size: 0.85rem;
}

.timeline-option:hover {
    border-color: rgba(0, 126, 255, 0.4);
    background: rgba(0, 126, 255, 0.1);
}

.timeline-option.selected {
    background: rgba(0, 126, 255, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 126, 255, 0.3);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.9rem;
    background: rgba(0, 126, 255, 0.05);
    border: 2px solid rgba(0, 126, 255, 0.2);
    border-radius: 10px;
    color: var(--white);
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
    margin-bottom: 1.2rem;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: rgba(160, 160, 160, 0.5);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(0, 126, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(0, 126, 255, 0.15), 0 0 20px rgba(0, 126, 255, 0.3);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.optional-label {
    color: var(--text-lighter);
    font-size: 0.8rem;
    font-style: italic;
    margin-left: 0.5rem;
}

/* Navigation Buttons */
.modal-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 126, 255, 0.2);
}

.btn-modal {
    padding: 0.9rem 2rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-back {
    background: transparent;
    color: var(--text-light);
    border: 2px solid rgba(0, 126, 255, 0.3);
}

.btn-back:hover {
    background: rgba(0, 126, 255, 0.1);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-next,
.btn-submit {
    background: var(--primary-color);
    color: var(--white);
    border: 2px solid var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 126, 255, 0.4);
    flex: 1;
}

.btn-next::before,
.btn-submit::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
    z-index: -1;
}

.btn-next:hover,
.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 126, 255, 0.5);
}

.btn-next:hover::before,
.btn-submit:hover::before {
    width: 400px;
    height: 400px;
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Success Message */
.success-screen {
    display: none;
    text-align: center;
    padding: 3rem 2rem;
    animation: fadeInScale 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.success-screen.active {
    display: block;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.success-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 2rem;
    border-radius: 50%;
    background: rgba(39, 201, 63, 0.1);
    border: 3px solid #27c93f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #27c93f;
    animation: successPulse 2s ease-in-out infinite;
}

@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(39, 201, 63, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(39, 201, 63, 0);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.success-screen h3 {
    font-size: 2rem;
    color: var(--white);
    margin-bottom: 1rem;
}

.success-screen p {
    color: var(--text-light);
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.success-screen .highlight {
    color: var(--primary-color);
    font-weight: 600;
}

/* Squash & Shimmer Effect for Hero Button */
.btn-primary.project-cta {
    position: relative;
    overflow: hidden;
    /* Reset button element styles but keep primary styling */
    border: none;
    font-family: inherit;
    cursor: pointer;
    /* Primary color with 40% opacity */
    background: rgba(0, 126, 255, 0.4) !important;
    transition: background 0.3s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s ease;
}

/* Hover: Full opacity */
.btn-primary.project-cta:hover {
    background: rgba(0, 126, 255, 1) !important;
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 126, 255, 0.5);
}

/* Shimmer effect */
.btn-primary.project-cta::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-primary.project-cta:hover::after {
    left: 100%;
}

/* Squash effect on click */
.btn-primary.project-cta:active {
    transform: scale(0.95) translateY(-2px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .project-modal {
        width: 96%;
        max-height: 92vh;
    }

    .modal-header {
        padding: 1.5rem;
    }

    .modal-header h2 {
        font-size: 1.3rem;
        padding-right: 40px;
        line-height: 1.3;
    }

    .modal-body {
        padding: 1.5rem;
        max-height: calc(92vh - 120px);
    }

    .option-cards,
    .service-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .option-card {
        padding: 1.8rem;
        min-height: 150px;
    }

    .option-card h3 {
        font-size: 1.2rem;
    }

    .service-card-modal {
        padding: 1.5rem;
        min-height: 120px;
    }

    .timeline-options {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .timeline-option {
        padding: 1.2rem;
        font-size: 1rem;
    }

    .modal-nav {
        flex-direction: column-reverse;
        gap: 0.8rem;
    }

    .btn-modal {
        width: 100%;
        padding: 1.2rem 2rem;
        font-size: 1rem;
    }

    .step-question {
        font-size: 1.3rem;
        margin-bottom: 2rem;
    }

    .form-label {
        font-size: 1rem;
    }

    .form-input,
    .form-textarea {
        padding: 1.1rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .project-modal {
        width: 98%;
        max-height: 94vh;
    }

    .modal-header {
        padding: 1.2rem;
    }

    .modal-header h2 {
        font-size: 1.1rem;
        line-height: 1.3;
    }

    .modal-body {
        padding: 1.2rem;
        max-height: calc(94vh - 100px);
    }

    .step-question {
        font-size: 1.15rem;
        margin-bottom: 1.5rem;
    }

    .option-card {
        padding: 1.5rem;
        min-height: 130px;
    }

    .option-card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.6rem;
    }

    .option-card p {
        font-size: 0.9rem;
    }

    .service-card-modal {
        padding: 1.3rem;
        min-height: 100px;
    }

    .service-card-modal h4 {
        font-size: 1rem;
    }

    .service-card-modal p {
        font-size: 0.85rem;
    }

    .timeline-option {
        padding: 1rem;
        font-size: 0.9rem;
    }

    .form-label {
        font-size: 0.9rem;
    }

    .btn-modal {
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
    }
}
