/**
 * SmartDuck Contact Form Styles
 *
 * Multi-step form with SmartDuck branding
 * - Mobile: Slide-in panel from right
 * - Desktop: Centered modal popup
 *
 * Colors: Orange #ff7e04, Pink #da1984
 * Fonts: Montserrat (body), Neulis Cursive (headings)
 */

/* ============================================
   CSS VARIABLES
   ============================================ */

#smartduck-form-modal {
    --sd-orange: #ff7e04;
    --sd-pink: #da1984;
    --sd-gradient: linear-gradient(90deg, var(--sd-orange), var(--sd-pink));
    --sd-grey: rgb(75, 85, 99);
    --sd-light-grey: #f5f5f5;
    --sd-border: #e5e5e5;
    --sd-white: #ffffff;
    --sd-radius: 12px;
    --sd-radius-sm: 8px;
    --sd-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --sd-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   BASE CONTAINER (MODAL & SLIDER)
   ============================================ */

#smartduck-form-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    visibility: hidden;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#smartduck-form-modal.active {
    pointer-events: auto;
    visibility: visible;
}

/* Overlay */
#smartduck-form-modal .sd-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: background var(--sd-transition);
}

#smartduck-form-modal.active .sd-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

/* ============================================
   MOBILE SLIDER
   ============================================ */

#smartduck-form-modal.sd-slider .sd-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    background: var(--sd-white);
    transform: translateX(100%);
    transition: transform var(--sd-transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#smartduck-form-modal.sd-slider.active .sd-panel {
    transform: translateX(0);
}

/* ============================================
   DESKTOP MODAL
   ============================================ */

#smartduck-form-modal.sd-modal .sd-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    background: var(--sd-white);
    border-radius: var(--sd-radius);
    box-shadow: var(--sd-shadow);
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    transition: transform var(--sd-transition), opacity var(--sd-transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#smartduck-form-modal.sd-modal.active .sd-panel {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* ============================================
   HEADER
   ============================================ */

#smartduck-form-modal .sd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--sd-gradient);
    flex-shrink: 0;
}

#smartduck-form-modal .sd-title {
    font-family: 'Neulis Cursive', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--sd-white);
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

#smartduck-form-modal .sd-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

#smartduck-form-modal .sd-close:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.05);
}

#smartduck-form-modal .sd-close svg {
    color: var(--sd-white);
    width: 20px;
    height: 20px;
}

/* ============================================
   CONTENT
   ============================================ */

#smartduck-form-modal .sd-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   FORM CONTAINER
   ============================================ */

#smartduck-form-modal .sd-form-container {
    padding: 20px;
}

/* ============================================
   PROGRESS BAR
   ============================================ */

#smartduck-form-modal .sd-form-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
    padding: 0 8px;
}

#smartduck-form-modal .sd-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#smartduck-form-modal .sd-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sd-light-grey);
    color: var(--sd-grey);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    transition: all var(--sd-transition);
}

#smartduck-form-modal .sd-progress-step.active .sd-step-number,
#smartduck-form-modal .sd-progress-step.completed .sd-step-number {
    background: var(--sd-gradient);
    color: var(--sd-white);
}

#smartduck-form-modal .sd-step-label {
    font-size: 12px;
    color: var(--sd-grey);
    font-weight: 500;
    white-space: nowrap;
}

#smartduck-form-modal .sd-progress-step.active .sd-step-label {
    color: var(--sd-orange);
    font-weight: 600;
}

#smartduck-form-modal .sd-progress-line {
    flex: 1;
    height: 3px;
    background: var(--sd-border);
    margin: 0 8px;
    margin-bottom: 20px;
    border-radius: 2px;
    min-width: 30px;
    max-width: 60px;
}

/* ============================================
   FORM STEPS
   ============================================ */

#smartduck-form-modal .sd-form-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

#smartduck-form-modal .sd-form-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#smartduck-form-modal .sd-step-title {
    font-family: 'Neulis Cursive', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 4px 0;
    text-align: center;
    text-transform: uppercase;
}

#smartduck-form-modal .sd-step-subtitle {
    font-size: 14px;
    color: var(--sd-grey);
    margin: 0 0 16px 0;
    text-align: center;
    line-height: 1.5;
}

/* ============================================
   FORM GROUPS
   ============================================ */

#smartduck-form-modal .sd-form-group {
    margin-bottom: 14px;
}

#smartduck-form-modal .sd-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

#smartduck-form-modal .sd-form-group input,
#smartduck-form-modal .sd-form-group select {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    border: 2px solid var(--sd-border);
    border-radius: var(--sd-radius-sm);
    background: var(--sd-white);
    color: #1a1a1a;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

#smartduck-form-modal .sd-form-group input::placeholder {
    color: #aaa;
}

#smartduck-form-modal .sd-form-group input:focus,
#smartduck-form-modal .sd-form-group select:focus {
    outline: none;
    border-color: var(--sd-orange);
    box-shadow: 0 0 0 4px rgba(255, 126, 4, 0.1);
}

#smartduck-form-modal .sd-form-group input.error {
    border-color: #ef4444;
}

#smartduck-form-modal .sd-form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 44px;
}

#smartduck-form-modal .sd-error-message {
    display: block;
    font-size: 12px;
    color: #ef4444;
    margin-top: 4px;
    min-height: 16px;
}

/* ============================================
   FORM ACTIONS
   ============================================ */

#smartduck-form-modal .sd-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

#smartduck-form-modal .sd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--sd-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

#smartduck-form-modal .sd-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#smartduck-form-modal .sd-btn-primary {
    background: var(--sd-gradient);
    color: var(--sd-white);
}

#smartduck-form-modal .sd-btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 126, 4, 0.3);
}

#smartduck-form-modal .sd-btn-secondary {
    background: var(--sd-light-grey);
    color: var(--sd-grey);
    flex: 0 0 auto;
}

#smartduck-form-modal .sd-btn-secondary:hover {
    background: var(--sd-border);
}

#smartduck-form-modal .sd-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ============================================
   SPINNER
   ============================================ */

#smartduck-form-modal .sd-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   SUCCESS STATE
   ============================================ */

#smartduck-form-modal .sd-success-container {
    text-align: center;
    padding: 20px 0;
}

#smartduck-form-modal .sd-success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: successPop 0.4s ease;
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#smartduck-form-modal .sd-success-icon svg {
    color: #16a34a;
    width: 40px;
    height: 40px;
}

#smartduck-form-modal .sd-success-title {
    font-family: 'Neulis Cursive', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    text-transform: uppercase;
}

#smartduck-form-modal .sd-success-message {
    font-size: 16px;
    color: var(--sd-grey);
    line-height: 1.6;
    margin: 0 0 28px 0;
}

#smartduck-form-modal .sd-success-container .sd-btn {
    width: auto;
    flex: none;
    padding: 14px 40px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (min-width: 768px) {
    #smartduck-form-modal .sd-form-container {
        padding: 24px 32px;
    }

    #smartduck-form-modal .sd-header {
        padding: 16px 32px;
    }

    #smartduck-form-modal .sd-title {
        font-size: 20px;
    }

    #smartduck-form-modal .sd-step-title {
        font-size: 22px;
        margin-bottom: 4px;
    }

    #smartduck-form-modal .sd-step-subtitle {
        margin-bottom: 20px;
    }

    #smartduck-form-modal .sd-form-progress {
        margin-bottom: 24px;
    }

    #smartduck-form-modal .sd-progress-line {
        max-width: 80px;
    }

    /* Compact form fields on desktop */
    #smartduck-form-modal .sd-form-group {
        margin-bottom: 14px;
    }

    #smartduck-form-modal .sd-form-group label {
        margin-bottom: 6px;
        font-size: 13px;
    }

    #smartduck-form-modal .sd-form-group input,
    #smartduck-form-modal .sd-form-group select {
        padding: 12px 14px;
        font-size: 15px;
    }

    #smartduck-form-modal .sd-error-message {
        min-height: 16px;
        margin-top: 4px;
        font-size: 12px;
    }

    #smartduck-form-modal .sd-form-actions {
        margin-top: 20px;
    }

    #smartduck-form-modal .sd-btn {
        padding: 12px 20px;
        font-size: 15px;
    }
}

@media (max-width: 400px) {
    #smartduck-form-modal .sd-form-progress {
        gap: 4px;
    }

    #smartduck-form-modal .sd-step-label {
        font-size: 10px;
    }

    #smartduck-form-modal .sd-progress-line {
        min-width: 20px;
    }

    #smartduck-form-modal .sd-form-actions {
        flex-direction: column;
    }

    #smartduck-form-modal .sd-btn-secondary {
        order: 1;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    #smartduck-form-modal,
    #smartduck-form-modal * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
