/**
 * Plugin Liên Hệ Pro - Frontend Styles
 * Modern, responsive contact form design
 */

/* ===== CSS Variables ===== */
.plh-contact-wrapper {
    --plh-primary: #6366f1;
    --plh-primary-dark: #4f46e5;
    --plh-primary-light: rgba(99, 102, 241, 0.1);
    --plh-primary-glow: rgba(99, 102, 241, 0.4);
    
    --plh-bg: #ffffff;
    --plh-bg-secondary: #f8fafc;
    --plh-bg-tertiary: #f1f5f9;
    
    --plh-text: #1e293b;
    --plh-text-secondary: #64748b;
    --plh-text-muted: #94a3b8;
    
    --plh-border: #e2e8f0;
    --plh-border-focus: var(--plh-primary);
    
    --plh-success: #10b981;
    --plh-success-bg: rgba(16, 185, 129, 0.1);
    --plh-error: #ef4444;
    --plh-error-bg: rgba(239, 68, 68, 0.1);
    
    --plh-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --plh-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --plh-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --plh-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    --plh-radius-sm: 8px;
    --plh-radius: 12px;
    --plh-radius-lg: 16px;
    --plh-radius-xl: 24px;
    
    --plh-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --plh-transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Oxygen', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .plh-contact-wrapper[data-theme="auto"] {
        --plh-bg: #0f172a;
        --plh-bg-secondary: #1e293b;
        --plh-bg-tertiary: #334155;
        --plh-text: #f1f5f9;
        --plh-text-secondary: #cbd5e1;
        --plh-text-muted: #64748b;
        --plh-border: #334155;
    }
}

/* ===== Container ===== */
.plh-contact-container {
    position: relative;
    max-width: 680px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.plh-contact-inner {
    position: relative;
    background: var(--plh-bg);
    border-radius: var(--plh-radius-xl);
    box-shadow: var(--plh-shadow-xl);
    padding: 2.5rem;
    overflow: hidden;
    border: 1px solid var(--plh-border);
}

/* ===== Decorative Background ===== */
.plh-bg-decoration {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.plh-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
}

.plh-blob-1 {
    width: 300px;
    height: 300px;
    background: var(--plh-primary-light);
    top: -100px;
    right: -100px;
    animation: plh-float 8s ease-in-out infinite;
}

.plh-blob-2 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, var(--plh-primary-light), rgba(236, 72, 153, 0.1));
    bottom: -80px;
    left: -80px;
    animation: plh-float 10s ease-in-out infinite reverse;
}

.plh-grid-pattern {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(var(--plh-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--plh-border) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.3;
    mask-image: radial-gradient(ellipse at center, transparent 20%, black 100%);
    -webkit-mask-image: radial-gradient(ellipse at center, transparent 20%, black 100%);
}

@keyframes plh-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(20px, -20px) scale(1.05); }
    66% { transform: translate(-10px, 10px) scale(0.95); }
}

/* ===== Header ===== */
.plh-header {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-bottom: 2rem;
}

.plh-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--plh-primary), var(--plh-primary-dark));
    border-radius: 50%;
    margin-bottom: 1.25rem;
    box-shadow: 
        0 10px 30px var(--plh-primary-glow),
        inset 0 -2px 10px rgba(0, 0, 0, 0.1);
    animation: plh-pulse 3s ease-in-out infinite;
}

.plh-mail-icon {
    width: 32px;
    height: 32px;
    color: #fff;
}

@keyframes plh-pulse {
    0%, 100% { box-shadow: 0 10px 30px var(--plh-primary-glow); }
    50% { box-shadow: 0 15px 40px var(--plh-primary-glow), 0 0 0 8px var(--plh-primary-light); }
}

.plh-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--plh-text);
    margin: 0 0 0.5rem;
    letter-spacing: -0.025em;
}

.plh-subtitle {
    font-size: 1rem;
    color: var(--plh-text-secondary);
    margin: 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Form ===== */
.plh-form {
    position: relative;
    z-index: 1;
}

.plh-hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.plh-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* ===== Form Fields ===== */
.plh-field {
    display: flex;
    flex-direction: column;
}

.plh-field-message {
    grid-column: 1 / -1;
}

.plh-label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--plh-text);
}

.plh-required {
    color: var(--plh-error);
    font-weight: 400;
}

.plh-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.plh-input-icon {
    position: absolute;
    left: 1rem;
    width: 20px;
    height: 20px;
    color: var(--plh-text-muted);
    transition: color var(--plh-transition);
    pointer-events: none;
    z-index: 1;
}

.plh-input-icon svg {
    width: 100%;
    height: 100%;
}

.plh-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    font-size: 1rem;
    color: var(--plh-text);
    background: var(--plh-bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--plh-radius);
    transition: all var(--plh-transition);
    outline: none;
    font-family: inherit;
}

.plh-input::placeholder {
    color: var(--plh-text-muted);
}

.plh-input:hover {
    background: var(--plh-bg-tertiary);
}

.plh-input:focus {
    background: var(--plh-bg);
    border-color: var(--plh-primary);
    box-shadow: 0 0 0 4px var(--plh-primary-light);
}

.plh-input:focus + .plh-input-focus-line,
.plh-input:focus ~ .plh-input-icon {
    color: var(--plh-primary);
}

.plh-input-focus-line {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--plh-primary);
    transition: all var(--plh-transition);
    transform: translateX(-50%);
    border-radius: 2px;
}

.plh-input:focus ~ .plh-input-focus-line {
    width: calc(100% - 2rem);
}

/* Error state */
.plh-field.has-error .plh-input,
.plh-field.has-error .plh-textarea {
    border-color: var(--plh-error);
    background: var(--plh-error-bg);
}

.plh-field.has-error .plh-input-icon {
    color: var(--plh-error);
}

/* Valid state */
.plh-field.is-valid .plh-input,
.plh-field.is-valid .plh-textarea {
    border-color: var(--plh-success);
}

.plh-field.is-valid .plh-input-icon {
    color: var(--plh-success);
}

/* ===== Textarea ===== */
.plh-textarea-wrapper {
    position: relative;
}

.plh-textarea {
    width: 100%;
    min-height: 140px;
    padding: 1rem;
    font-size: 1rem;
    color: var(--plh-text);
    background: var(--plh-bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--plh-radius);
    transition: all var(--plh-transition);
    outline: none;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
}

.plh-textarea::placeholder {
    color: var(--plh-text-muted);
}

.plh-textarea:hover {
    background: var(--plh-bg-tertiary);
}

.plh-textarea:focus {
    background: var(--plh-bg);
    border-color: var(--plh-primary);
    box-shadow: 0 0 0 4px var(--plh-primary-light);
}

.plh-textarea-focus-line {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--plh-primary);
    transition: all var(--plh-transition);
    transform: translateX(-50%);
    border-radius: 2px;
}

.plh-textarea:focus ~ .plh-textarea-focus-line {
    width: calc(100% - 2rem);
}

.plh-char-count {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    font-size: 0.75rem;
    color: var(--plh-text-muted);
    background: var(--plh-bg);
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity var(--plh-transition);
}

.plh-textarea:focus ~ .plh-char-count {
    opacity: 1;
}

/* ===== Error Messages ===== */
.plh-error-message {
    display: block;
    min-height: 1.25rem;
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: var(--plh-error);
    opacity: 0;
    transform: translateY(-5px);
    transition: all var(--plh-transition-fast);
}

.plh-field.has-error .plh-error-message {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Submit Button ===== */
.plh-submit-wrapper {
    margin-top: 1.5rem;
}

.plh-submit-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.0625rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--plh-primary), var(--plh-primary-dark));
    border: none;
    border-radius: var(--plh-radius);
    cursor: pointer;
    overflow: hidden;
    transition: all var(--plh-transition);
    font-family: inherit;
    box-shadow: 0 4px 15px var(--plh-primary-glow);
}

.plh-submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity var(--plh-transition);
}

.plh-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--plh-primary-glow);
}

.plh-submit-btn:hover::before {
    opacity: 1;
}

.plh-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px var(--plh-primary-glow);
}

.plh-btn-icon svg {
    width: 20px;
    height: 20px;
    transition: transform var(--plh-transition);
}

.plh-submit-btn:hover .plh-btn-icon svg {
    transform: translateX(4px) translateY(-4px);
}

.plh-btn-loading {
    display: none;
}

.plh-submit-btn.is-loading .plh-btn-text,
.plh-submit-btn.is-loading .plh-btn-icon {
    opacity: 0;
    visibility: hidden;
}

.plh-submit-btn.is-loading .plh-btn-loading {
    display: flex;
    position: absolute;
}

.plh-spinner {
    width: 24px;
    height: 24px;
    animation: plh-spin 1s linear infinite;
}

@keyframes plh-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.plh-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ===== Response Messages ===== */
.plh-response {
    display: none;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1.25rem;
    border-radius: var(--plh-radius);
    animation: plh-slideIn 0.4s ease;
}

@keyframes plh-slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.plh-response.is-visible {
    display: flex;
}

.plh-response-success {
    background: var(--plh-success-bg);
    border: 1px solid var(--plh-success);
}

.plh-response-success .plh-response-icon {
    color: var(--plh-success);
}

.plh-response-error {
    background: var(--plh-error-bg);
    border: 1px solid var(--plh-error);
}

.plh-response-error .plh-response-icon {
    color: var(--plh-error);
}

.plh-response-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.plh-response-icon svg {
    width: 100%;
    height: 100%;
}

.plh-response-message {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--plh-text);
    line-height: 1.5;
}

/* ===== Footer Info ===== */
.plh-footer-info {
    margin-top: 2rem;
    text-align: center;
}

.plh-security-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    color: var(--plh-text-muted);
    background: var(--plh-bg-secondary);
    border-radius: 100px;
}

.plh-security-badge svg {
    width: 16px;
    height: 16px;
    color: var(--plh-success);
}

/* ===== Responsive Design ===== */
@media (max-width: 640px) {
    .plh-contact-container {
        margin: 1rem auto;
        padding: 0 0.75rem;
    }
    
    .plh-contact-inner {
        padding: 1.5rem;
        border-radius: var(--plh-radius-lg);
    }
    
    .plh-form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .plh-icon-wrapper {
        width: 60px;
        height: 60px;
    }
    
    .plh-mail-icon {
        width: 28px;
        height: 28px;
    }
    
    .plh-title {
        font-size: 1.5rem;
    }
    
    .plh-subtitle {
        font-size: 0.9375rem;
    }
    
    .plh-input {
        padding: 0.75rem 0.875rem 0.75rem 2.75rem;
        font-size: 1rem;
    }
    
    .plh-input-icon {
        left: 0.875rem;
        width: 18px;
        height: 18px;
    }
    
    .plh-textarea {
        min-height: 120px;
        padding: 0.875rem;
    }
    
    .plh-submit-btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .plh-blob-1 {
        width: 200px;
        height: 200px;
        top: -60px;
        right: -60px;
    }
    
    .plh-blob-2 {
        width: 150px;
        height: 150px;
        bottom: -40px;
        left: -40px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .plh-input,
    .plh-textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .plh-submit-btn:hover {
        transform: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .plh-contact-wrapper {
        --plh-border: #000;
    }
    
    .plh-input,
    .plh-textarea {
        border: 2px solid var(--plh-text);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .plh-contact-wrapper *,
    .plh-contact-wrapper *::before,
    .plh-contact-wrapper *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Theme: Glassmorphism ===== */
.plh-contact-wrapper[data-theme="glassmorphism"] .plh-contact-inner {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.plh-contact-wrapper[data-theme="glassmorphism"] .plh-input,
.plh-contact-wrapper[data-theme="glassmorphism"] .plh-textarea {
    background: rgba(255, 255, 255, 0.5);
}

/* ===== Theme: Minimal ===== */
.plh-contact-wrapper[data-theme="minimal"] .plh-contact-inner {
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 1rem;
}

.plh-contact-wrapper[data-theme="minimal"] .plh-bg-decoration {
    display: none;
}

.plh-contact-wrapper[data-theme="minimal"] .plh-icon-wrapper {
    display: none;
}

.plh-contact-wrapper[data-theme="minimal"] .plh-header {
    text-align: left;
}

.plh-contact-wrapper[data-theme="minimal"] .plh-submit-btn {
    border-radius: 4px;
    box-shadow: none;
}

/* Print styles */
@media print {
    .plh-contact-wrapper {
        display: none;
    }
}
