/* ===================================
   PHNX CONSULTATION MODAL STYLES
   =================================== */

/* Typography & Font Loading */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Typography */
  --font-ui: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-luxe: "Fraunces", Georgia, "Times New Roman", serif;
  
  /* Colors */
  --tb-max: 1200px;
  --gold: 212,175,55;
  --bar-bg: linear-gradient(180deg, #0b1220 0%, #0e172a 55%, #0b1220 100%);
}

/* Modal Base Styles */
.phnx-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-ui);
}

.phnx-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Modal Overlay */
.phnx-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Modal Panel */
.phnx-modal__panel {
    position: relative;
    background: white;
    border-radius: 20px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-ui);
}

.phnx-modal[aria-hidden="false"] .phnx-modal__panel {
    transform: scale(1) translateY(0);
}

/* Close Button */
.phnx-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(107, 114, 128, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6B7280;
    transition: all 0.2s ease;
    z-index: 10;
}

.phnx-modal__close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    transform: scale(1.05);
}

.phnx-modal__close:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

.phnx-modal__close svg {
    width: 18px;
    height: 18px;
}

/* Modal Header */
.phnx-modal__header {
    padding: 40px 40px 20px;
    text-align: center;
    border-bottom: 1px solid #F3F4F6;
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
}

.phnx-modal__title {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
    color: #1F2937;
    line-height: 1.2;
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: var(--font-luxe);
}

.phnx-modal__subtitle {
    margin: 0;
    font-size: 16px;
    color: #6B7280;
    line-height: 1.5;
    font-weight: 500;
    font-family: var(--font-ui);
}

/* Form Container */
.phnx-modal__form {
    padding: 30px 40px 40px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

/* Custom Scrollbar */
.phnx-modal__form::-webkit-scrollbar {
    width: 6px;
}

.phnx-modal__form::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 3px;
}

.phnx-modal__form::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 3px;
}

.phnx-modal__form::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* Field Styles */
.phnx-field {
    margin-bottom: 24px;
}

.phnx-field__label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    line-height: 1.4;
    font-family: var(--font-ui);
}

.phnx-required {
    color: #EF4444;
    font-weight: 700;
}

/* Input and Textarea Base Styles */
.phnx-field__input,
.phnx-field__textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    font-size: 16px;
    font-family: var(--font-ui);
    line-height: 1.5;
    color: #374151;
    background: #FFFFFF;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.phnx-field__input:focus,
.phnx-field__textarea:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 
        0 0 0 4px rgba(59, 130, 246, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.phnx-field__input::placeholder,
.phnx-field__textarea::placeholder {
    color: #9CA3AF;
    font-size: 15px;
}

/* Textarea Specific */
.phnx-field__textarea {
    resize: vertical;
    min-height: 100px;
    font-family: var(--font-ui);
}

/* Error States */
.phnx-field--error .phnx-field__input,
.phnx-field--error .phnx-field__textarea {
    border-color: #EF4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.phnx-field--error .phnx-field__label {
    color: #EF4444;
}

.phnx-field__error {
    margin-top: 6px;
    font-size: 13px;
    color: #EF4444;
    font-weight: 500;
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ui);
}

.phnx-field__error:before {
    content: '⚠';
    font-size: 12px;
}

/* Submit Button */
.phnx-btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-ui);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 20px;
}

.phnx-btn--primary {
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    color: white;
    box-shadow: 
        0 4px 14px rgba(37, 99, 235, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.1);
}

.phnx-btn--primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(37, 99, 235, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.15);
}

.phnx-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* Button States */
.phnx-btn__loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.phnx-btn.loading .phnx-btn__text {
    display: none;
}

.phnx-btn.loading .phnx-btn__loading {
    display: flex;
}

/* Loading Spinner */
.phnx-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Form Status Messages */
.phnx-form-status {
    margin-top: 20px;
    padding: 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    font-family: var(--font-ui);
}

.phnx-form-status.show {
    opacity: 1;
    transform: translateY(0);
}

.phnx-form-status.success {
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.phnx-form-status.error {
    background: linear-gradient(135deg, #FEF2F2 0%, #FECACA 100%);
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

.phnx-form-status:before {
    font-size: 16px;
}

.phnx-form-status.success:before {
    content: '✓';
    color: #10B981;
}

.phnx-form-status.error:before {
    content: '⚠';
    color: #EF4444;
}

/* Responsive Design */
@media (max-width: 640px) {
    .phnx-modal {
        padding: 16px;
    }

    .phnx-modal__panel {
        border-radius: 16px;
        max-height: 95vh;
    }

    .phnx-modal__header {
        padding: 30px 24px 16px;
    }

    .phnx-modal__title {
        font-size: 24px;
    }

    .phnx-modal__subtitle {
        font-size: 15px;
    }

    .phnx-modal__form {
        padding: 24px;
        max-height: calc(95vh - 120px);
    }

    .phnx-modal__close {
        top: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
    }

    .phnx-modal__close svg {
        width: 16px;
        height: 16px;
    }

    .phnx-field {
        margin-bottom: 20px;
    }

    .phnx-field__input,
    .phnx-field__textarea {
        padding: 12px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .phnx-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .phnx-modal {
        padding: 12px;
    }

    .phnx-modal__header {
        padding: 24px 20px 12px;
    }

    .phnx-modal__form {
        padding: 20px;
    }

    .phnx-modal__title {
        font-size: 22px;
    }

    .phnx-field__input,
    .phnx-field__textarea {
        padding: 12px;
    }
}

/* Animation for modal entrance */
@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Focus trap improvements */
.phnx-modal[aria-hidden="false"] {
    animation: modalEnter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .phnx-modal,
    .phnx-modal__panel,
    .phnx-btn,
    .phnx-field__input,
    .phnx-field__textarea,
    .phnx-form-status {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .phnx-modal__panel {
        border: 2px solid #000;
    }
    
    .phnx-field__input,
    .phnx-field__textarea {
        border-width: 2px;
    }
    
    .phnx-btn--primary {
        background: #000;
        border: 2px solid #000;
    }
}