/* ==================================================
   CUSTOMER INFO MODAL STYLES - Matching Company Info Modal
   ================================================== */

/* ==================================================
   1. MODAL BASE & SIZING
   ================================================== */

#customerInfoModal {
    z-index: 10000 !important;
}

/* When shown on top of Proposal Manager, stack above PM (10050) */
body:has(#proposalManagerModal.show):has(#customerInfoModal.show) #customerInfoModal,
body:has(#customerInfoModal.show) #customerInfoModal.show {
    z-index: 10060 !important;
}
body:has(#proposalManagerModal.show):has(#customerInfoModal.show) #customerInfoModal .modal-dialog,
body:has(#customerInfoModal.show) #customerInfoModal.show .modal-dialog {
    z-index: 10061 !important;
}
body:has(#proposalManagerModal.show):has(#customerInfoModal.show) #customerInfoModal .modal-content,
body:has(#customerInfoModal.show) #customerInfoModal.show .modal-content {
    z-index: 10061 !important;
}

#customerInfoModal + .modal-backdrop {
    z-index: 9999 !important;
}
body:has(#proposalManagerModal.show):has(#customerInfoModal.show) .modal-backdrop:last-of-type {
    z-index: 10059 !important;
}

body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    left: 0 !important;
    right: 0 !important;
}

#customerInfoModal .modal-dialog {
    z-index: 10000 !important;
    max-width: 600px;
    margin: 80px auto 20px auto !important; /* Consistent top positioning - 60px header + 20px spacing */
    display: flex;
    flex-direction: column;
    align-items: flex-start !important; /* Align to top */
    min-height: auto !important;
}

#customerInfoModal .modal-content {
    z-index: 10000 !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.06) !important;
    border: 1px solid #e2e8f0 !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

/* ==================================================
   2. HEADER - Compact B2B Design (smaller, professional)
   ================================================== */

#customerInfoModal .modal-header {
    background: #f8fafc !important;
    color: #1e293b !important;
    padding: 14px 20px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
    border-radius: 12px 12px 0 0 !important;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

#customerInfoModal .modal-header .header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

#customerInfoModal .modal-header .header-icon {
    font-size: 20px !important;
    opacity: 0.9;
    color: #4b5563;
    transition: transform 0.2s ease;
}

#customerInfoModal .modal-header .header-icon:hover {
    transform: scale(1.05);
}

#customerInfoModal .modal-header .header-text {
    flex: 1;
    position: relative;
}

#customerInfoModal .modal-header .title-main {
    display: block;
    font-size: 15px !important;
    font-weight: 600 !important;
    margin-bottom: 2px !important;
    color: #0f172a;
    text-shadow: none;
    letter-spacing: -0.2px;
    line-height: 1.3;
    position: relative;
}

#customerInfoModal .modal-header .title-subtitle {
    display: block;
    font-size: 12px !important;
    font-weight: 400 !important;
    color: #64748b !important;
    text-shadow: none;
    letter-spacing: 0;
    line-height: 1.4;
    position: relative;
    padding-left: 18px;
    opacity: 1 !important;
}

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

/* Decorative accent line before subtitle */
#customerInfoModal .modal-header .title-subtitle::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 1.5px;
    background: #9ca3af;
    border-radius: 2px;
}

@keyframes lineExpand {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 16px;
        opacity: 1;
    }
}

#customerInfoModal .modal-header .close {
    color: #6b7280 !important;
    opacity: 0.9;
    font-size: 20px;
    font-weight: 400;
    transition: all 0.2s ease;
    padding: 4px;
    margin: -4px -4px 0 0;
    background: #d1d5db;
    border: 1px solid #9ca3af;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 3;
}

#customerInfoModal .modal-header .close:hover {
    opacity: 1;
    background: #e5e7eb;
    color: #374151 !important;
}

#customerInfoModal .modal-header .close:active {
    background: #9ca3af;
}

#customerInfoModal .modal-header .close:focus {
    outline: none;
    box-shadow: 0 0 0 2px #9ca3af;
}

/* ==================================================
   3. BODY - Match Company Info Modal
   ================================================== */

#customerInfoModal .modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px !important;
    background-color: #ffffff !important;
    min-height: auto;
}

/* ==================================================
   4. PROGRESS STEPS - Simple matching container
   ================================================== */

#customerInfoModal .progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0;
    margin: 0 0 12px 0;
    padding: 14px 40px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

#customerInfoModal .step {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

/* Remove all connector lines */
#customerInfoModal .step:not(:last-child)::after,
#customerInfoModal .step::before,
#customerInfoModal .progress-steps::before,
#customerInfoModal .progress-steps::after {
    display: none !important;
    content: none !important;
}

#customerInfoModal .step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #64748b;
    transition: all 0.3s ease;
}

#customerInfoModal .step.active .step-number {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

#customerInfoModal .step.completed .step-number {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

/* Hide step labels */
#customerInfoModal .step-label {
    display: none;
}

/* ==================================================
   5. FORM CONTAINER - Match Company Info Editor Container
   ================================================== */

#customerInfoModal .customer-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fafbfc;
    border-radius: 10px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: none;
}

/* ==================================================
   6. FORM STEPS
   ================================================== */

.form-step {
    display: none;
}

.form-step.active {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Step header */
.step-header {
    margin-bottom: 0;
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.step-header:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.step-header h6 {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.step-header h6 i {
    color: #667eea;
    font-size: 14px;
    width: 16px;
}

/* ==================================================
   7. FORM FIELDS - Match Company Info Form Groups
   ================================================== */

.contact-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#customerInfoModal .contact-option,
#customerInfoModal .step1-customer-field,
#customerInfoModal .step1-address-field,
#customerInfoModal .step3-proposal-field,
#customerInfoModal .step3-date-field {
    margin-bottom: 12px;
    position: relative;
    background: white;
    border-radius: 8px;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#customerInfoModal .contact-option:hover,
#customerInfoModal .step1-customer-field:hover,
#customerInfoModal .step1-address-field:hover,
#customerInfoModal .step3-proposal-field:hover,
#customerInfoModal .step3-date-field:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

#customerInfoModal .contact-option:focus-within,
#customerInfoModal .step1-customer-field:focus-within,
#customerInfoModal .step1-address-field:focus-within,
#customerInfoModal .step3-proposal-field:focus-within,
#customerInfoModal .step3-date-field:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* Focus effect bottom line - Match Company Info */
#customerInfoModal .contact-option::after,
#customerInfoModal .step1-customer-field::after,
#customerInfoModal .step1-address-field::after,
#customerInfoModal .step3-proposal-field::after,
#customerInfoModal .step3-date-field::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease;
    transform: translateX(-50%);
    border-radius: 1px;
}

#customerInfoModal .contact-option:focus-within::after,
#customerInfoModal .step1-customer-field:focus-within::after,
#customerInfoModal .step1-address-field:focus-within::after,
#customerInfoModal .step3-proposal-field:focus-within::after,
#customerInfoModal .step3-date-field:focus-within::after {
    width: 100%;
}

/* Colored left borders - Match Company Info colors */
/* Step 1: Customer Name Field - Purple */
#customerInfoModal .step1-customer-field {
    border-left: 4px solid #667eea;
}

/* Step 1: Address Field - Green */
#customerInfoModal .step1-address-field {
    border-left: 4px solid #10b981;
}

/* Step 2: Phone Field (first contact option) - Orange */
#customerInfoModal .contact-options .contact-option:nth-child(1) {
    border-left: 4px solid #f59e0b;
}

/* Step 2: Email Field (second contact option) - Purple */
#customerInfoModal .contact-options .contact-option:nth-child(2) {
    border-left: 4px solid #8b5cf6;
}

/* Step 3: Proposal Field - Cyan */
#customerInfoModal .step3-proposal-field {
    border-left: 4px solid #06b6d4;
}

/* Step 3: Date Field - Red */
#customerInfoModal .step3-date-field {
    border-left: 4px solid #ef4444;
}

/* ==================================================
   8. LABELS
   ================================================== */

#customerInfoModal .option-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

#customerInfoModal .option-header input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
    cursor: pointer;
}

#customerInfoModal .option-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#customerInfoModal .option-label i {
    width: 16px;
    font-size: 14px;
    flex-shrink: 0;
}

/* Match icon colors to border colors */
#customerInfoModal .step1-customer-field .option-label i {
    color: #667eea;
}

#customerInfoModal .step1-address-field .option-label i {
    color: #10b981;
}

#customerInfoModal .contact-options .contact-option:nth-child(1) .option-label i {
    color: #f59e0b;
}

#customerInfoModal .contact-options .contact-option:nth-child(2) .option-label i {
    color: #8b5cf6;
}

#customerInfoModal .step3-proposal-field .option-label i {
    color: #06b6d4;
}

#customerInfoModal .step3-date-field .option-label i {
    color: #ef4444;
}

/* Focus state label color */
#customerInfoModal .contact-option:focus-within .option-label,
#customerInfoModal .step1-customer-field:focus-within .option-label,
#customerInfoModal .step1-address-field:focus-within .option-label,
#customerInfoModal .step3-proposal-field:focus-within .option-label,
#customerInfoModal .step3-date-field:focus-within .option-label {
    color: #667eea;
}

#customerInfoModal .required {
    color: #ef4444;
    font-weight: 600;
}

/* ==================================================
   9. INPUT FIELDS - Match Company Info Inputs
   ================================================== */

.customer-form-group {
    position: relative;
}

.customer-input {
    width: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    color: #374151;
    background: #ffffff;
    transition: all 0.3s ease;
    font-weight: 500;
}

.customer-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
    background: #fafbff;
}

#customerInfoModal .customer-input::placeholder {
    color: #94a3b8;
    font-style: normal;
    font-weight: 400;
}

textarea.customer-input {
    resize: vertical;
    min-height: 80px;
}

/* Hide the focus border div */
.input-focus-border {
    display: none;
}

/* Form helper text */
.form-text {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 11px;
    color: #64748b;
}

.form-text i {
    color: #667eea;
    font-size: 11px;
    flex-shrink: 0;
}

/* ==================================================
   10. FOOTER - Match Company Info Footer
   ================================================== */

#customerInfoModal .modal-footer {
    flex-shrink: 0;
    padding: 10px 20px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background-color: #f1f5f9 !important;
    border-top: 1px solid #e0e4e8 !important;
    gap: 10px;
}

#customerInfoModal .footer-left,
#customerInfoModal .footer-center,
#customerInfoModal .footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

#customerInfoModal .footer-left {
    flex: 0 0 auto;
}

#customerInfoModal .footer-center {
    flex: 1;
    justify-content: center;
}

#customerInfoModal .footer-center:empty {
    flex: 0;
}

#customerInfoModal .footer-right {
    flex: 0 0 auto;
}

#customerInfoModal .footer-left .btn {
    margin-left: 0 !important;
}

/* ==================================================
   11. CUSTOMER INFO EDITOR CONTAINER (Legacy Support)
   ================================================== */

.customer-info-editor-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: linear-gradient(135deg, #f8faff 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.05);
}

.customer-info-editor-container .form-group {
    margin-bottom: 0;
    position: relative;
    background: white;
    border-radius: 8px;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.customer-info-editor-container .form-group:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.customer-info-editor-container .form-group:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.customer-info-editor-container label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.customer-info-editor-container .form-group:focus-within label {
    color: #667eea;
}

.customer-info-editor-container label i {
    color: #667eea;
    width: 16px;
    font-size: 14px;
    flex-shrink: 0;
}

.customer-info-editor-container .form-control {
    width: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    color: #374151;
    background: #ffffff;
    transition: all 0.3s ease;
    font-weight: 500;
}

.customer-info-editor-container .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
    background: #fafbff;
}

.customer-info-editor-container .form-control::placeholder {
    color: #9ca3af;
    font-style: italic;
    font-weight: 400;
}

/* Field-specific colors */
.customer-info-editor-container .form-group:nth-child(1) { border-left: 4px solid #667eea; }
.customer-info-editor-container .form-group:nth-child(1) label i { color: #667eea; }
.customer-info-editor-container .form-group:nth-child(2) { border-left: 4px solid #10b981; }
.customer-info-editor-container .form-group:nth-child(2) label i { color: #10b981; }
.customer-info-editor-container .form-group:nth-child(3) { border-left: 4px solid #f59e0b; }
.customer-info-editor-container .form-group:nth-child(3) label i { color: #f59e0b; }
.customer-info-editor-container .form-group:nth-child(4) { border-left: 4px solid #8b5cf6; }
.customer-info-editor-container .form-group:nth-child(4) label i { color: #8b5cf6; }
.customer-info-editor-container .form-group:nth-child(5) { border-left: 4px solid #06b6d4; }
.customer-info-editor-container .form-group:nth-child(5) label i { color: #06b6d4; }
.customer-info-editor-container .form-group:nth-child(6) { border-left: 4px solid #ef4444; }
.customer-info-editor-container .form-group:nth-child(6) label i { color: #ef4444; }

/* ==================================================
   12. RESPONSIVE DESIGN
   ================================================== */

@media (max-width: 768px) {
    #customerInfoModal .modal-dialog {
        max-width: 95vw;
        margin: 10px auto;
    }

    #customerInfoModal .modal-body {
        padding: 12px !important;
    }

    #customerInfoModal .progress-steps {
        padding: 12px 30px;
        justify-content: space-between;
        gap: 0;
    }

    .step:not(:last-child)::after {
        width: 30px;
        margin: 0 6px;
    }

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

    .step-label {
        font-size: 11px;
    }

    .customer-form {
        padding: 12px;
        gap: 10px;
    }

    .contact-option,
    .step1-customer-field,
    .step1-address-field,
    .step3-proposal-field,
    .step3-date-field {
        padding: 8px 10px;
    }

    .option-label {
        font-size: 11px;
    }

    .customer-input {
        padding: 7px 10px;
        font-size: 13px;
    }

    #customerInfoModal .modal-footer {
        padding: 10px 15px !important;
    }
}

@media (max-width: 576px) {
    #customerInfoModal .modal-dialog {
        max-width: 98vw;
        margin: 5px auto;
    }

    #customerInfoModal .modal-header {
        padding: 20px 22px !important;
    }
    
    #customerInfoModal .modal-header .header-icon {
        font-size: 32px !important;
    }
    
    #customerInfoModal .modal-header .title-main {
        font-size: 22px !important;
    }
    
    #customerInfoModal .modal-header .title-subtitle {
        font-size: 14px !important;
        padding-left: 28px;
    }
    
    #customerInfoModal .modal-header .title-subtitle::before {
        width: 20px;
        height: 2.5px;
    }
    
    #customerInfoModal .modal-header .close {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    #customerInfoModal .modal-body {
        padding: 10px !important;
    }

    #customerInfoModal .progress-steps {
        padding: 10px 20px;
        justify-content: space-between;
        gap: 0;
        flex-wrap: nowrap;
    }

    .step {
        flex-direction: column;
        gap: 4px;
    }

    .step:not(:last-child)::after {
        display: none;
    }

    .step-number {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }

    .step-label {
        font-size: 10px;
    }

    .customer-form {
        padding: 10px;
        gap: 10px;
        border-radius: 8px;
    }

    .contact-option,
    .step1-customer-field,
    .step1-address-field,
    .step3-proposal-field,
    .step3-date-field {
        padding: 8px 10px;
        border-radius: 6px;
    }

    .option-label {
        font-size: 11px;
    }

    .customer-input {
        padding: 7px 10px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 4px;
    }

    #customerInfoModal .modal-footer {
        padding: 12px !important;
        flex-direction: column;
        gap: 8px;
    }

    #customerInfoModal .footer-left,
    #customerInfoModal .footer-center,
    #customerInfoModal .footer-right {
        width: 100%;
        justify-content: center;
    }

    #customerInfoModal .footer-left {
        order: 2;
    }

    #customerInfoModal .footer-right {
        order: 1;
        flex-wrap: wrap;
    }
}

/* ==================================================
   13. ACCESSIBILITY
   ================================================== */

.customer-input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    #customerInfoModal .modal-header .title-main,
    #customerInfoModal .modal-header .title-subtitle {
        animation: none;
    }
    
    #customerInfoModal .modal-header .title-subtitle::before {
        animation: none;
        width: 16px;
        opacity: 1;
    }
    
    #customerInfoModal .modal-header .close {
        animation: none;
    }
    
    .contact-option,
    .step1-customer-field,
    .step1-address-field,
    .step3-proposal-field,
    .step3-date-field,
    .step-number,
    .customer-input {
        transition: none;
    }

    .step.active .step-number,
    .contact-option:hover,
    .step1-customer-field:hover,
    .step1-address-field:hover,
    .step3-proposal-field:hover,
    .step3-date-field:hover {
        transform: none;
    }
}
