/**
 * Consultation Widget Frontend Styles
 * Rich, colorful design — deep green / golden yellow / black palette
 * Compact sizing, especially on mobile.
 *
 * @package Consultation_Widget
 * @since 1.2.0
 */

/* ==========================================
   Variables & Base Styles
   ========================================== */
:root {
    --cw-primary: #1F5D4C;        /* سبز کله‌غازی */
    --cw-primary-dark: #163F33;
    --cw-primary-light: #2C7A63;
    --cw-gold: #D4AF37;           /* زرد طلایی */
    --cw-gold-light: #EAC85A;
    --cw-gold-dark: #B8952E;
    --cw-black: #14181A;          /* سیاه پر کلاغی */
    --cw-success: #1F5D4C;
    --cw-danger: #C0392B;
    --cw-text: var(--cw-black);
    --cw-text-light: #667069;
    --cw-border: #E1E4E1;
    --cw-bg: #ffffff;
    --cw-bg-soft: #F4F6F4;
    --cw-radius: 16px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ==========================================
   Container & Form
   ========================================== */
.cw-consultation-widget {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 12px;
}

.cw-consultation-form {
    position: relative;
    background: var(--cw-bg);
    border-radius: var(--cw-radius);
    padding: 28px 24px;
    overflow: hidden;
    box-shadow:
        0 10px 28px rgba(20, 24, 26, 0.12),
        0 2px 6px rgba(20, 24, 26, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: cw-fade-in-up 0.4s ease-out;
}

.cw-consultation-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--cw-primary) 0%, var(--cw-gold) 100%);
}

.cw-consultation-form:hover {
    box-shadow:
        0 14px 34px rgba(20, 24, 26, 0.16),
        0 3px 8px rgba(20, 24, 26, 0.08);
}

/* ==========================================
   Title & Description
   ========================================== */
.cw-form-title {
    font-size: 21px;
    font-weight: 800;
    text-align: center;
    margin: 6px 0 6px;
    background: linear-gradient(100deg, var(--cw-primary) 0%, var(--cw-gold-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cw-form-description {
    font-size: 13px;
    color: var(--cw-text-light);
    text-align: center;
    margin: 0 0 18px;
    line-height: 1.6;
}

/* ==========================================
   Form Fields
   ========================================== */
.cw-form-field {
    margin-bottom: 12px;
}

.cw-form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--cw-black);
    margin-bottom: 5px;
}

.cw-required {
    color: var(--cw-danger);
    margin-right: 4px;
}

.cw-form-input,
.cw-form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--cw-text);
    background: var(--cw-bg-soft);
    border: 1.5px solid var(--cw-border);
    border-radius: 10px;
    outline: none;
    transition: all 0.2s ease;
}

.cw-form-input:focus,
.cw-form-textarea:focus {
    background: var(--cw-bg);
    border-color: var(--cw-primary);
    box-shadow: 0 0 0 3px rgba(31, 93, 76, 0.12);
}

.cw-form-input::placeholder,
.cw-form-textarea::placeholder {
    color: #9aa39d;
}

.cw-form-textarea {
    min-height: 80px;
    resize: vertical;
}

/* ==========================================
   Messages
   ========================================== */
.cw-form-message {
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    animation: cw-slide-down 0.25s ease-out;
}

.cw-form-message.success {
    background: rgba(31, 93, 76, 0.1);
    color: var(--cw-primary-dark);
    border: 1.5px solid rgba(31, 93, 76, 0.3);
}

.cw-form-message.error {
    background: rgba(192, 57, 43, 0.1);
    color: var(--cw-danger);
    border: 1.5px solid rgba(192, 57, 43, 0.3);
}

@keyframes cw-slide-down {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   Submit Button
   ========================================== */
.cw-submit-button {
    width: 100%;
    padding: 12px 22px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: var(--cw-black);
    background: linear-gradient(120deg, var(--cw-gold), var(--cw-gold-light));
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.35);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.cw-submit-button:hover {
    background: linear-gradient(120deg, var(--cw-gold-dark), var(--cw-gold));
    transform: translateY(-2px);
    box-shadow: 0 9px 20px rgba(212, 175, 55, 0.45);
}

.cw-submit-button:active {
    transform: translateY(0);
}

.cw-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading Spinner */
.cw-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(20, 24, 26, 0.25);
    border-top-color: var(--cw-black);
    border-radius: 50%;
    animation: cw-spin 0.7s linear infinite;
}

@keyframes cw-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   WhatsApp Button
   ========================================== */
.cw-whatsapp-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 18px;
    margin-top: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(120deg, var(--cw-primary), var(--cw-primary-light));
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(31, 93, 76, 0.3);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.cw-whatsapp-button:hover {
    background: linear-gradient(120deg, var(--cw-primary-dark), var(--cw-primary));
    transform: translateY(-2px);
    box-shadow: 0 9px 20px rgba(31, 93, 76, 0.4);
}

.cw-whatsapp-icon {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}

/* ==========================================
   Motion
   ========================================== */
@keyframes cw-fade-in-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   Responsive — compact, but still colorful/beautiful
   ========================================== */
@media (max-width: 768px) {
    .cw-consultation-widget {
        padding: 8px;
        max-width: 100%;
    }

    .cw-consultation-form {
        padding: 20px 16px;
        border-radius: 12px;
    }

    .cw-form-title {
        font-size: 18px;
    }

    .cw-form-description {
        font-size: 12.5px;
        margin-bottom: 14px;
    }

    .cw-form-field {
        margin-bottom: 10px;
    }

    .cw-form-input,
    .cw-form-textarea {
        padding: 9px 12px;
        font-size: 13.5px;
    }

    .cw-submit-button,
    .cw-whatsapp-button {
        padding: 11px 16px;
        font-size: 14px;
    }

    .cw-consultation-form:hover {
        transform: none;
    }
}

/* ==========================================
   RTL Support
   ========================================== */
[dir="rtl"] .cw-consultation-form {
    text-align: right;
}

[dir="rtl"] .cw-required {
    margin-right: 0;
    margin-left: 4px;
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
    .cw-consultation-widget {
        display: none;
    }
}

/* ==========================================
   Accessibility
   ========================================== */
.cw-form-input:focus-visible,
.cw-form-textarea:focus-visible,
.cw-submit-button:focus-visible,
.cw-whatsapp-button:focus-visible {
    outline: 2px solid var(--cw-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================
   Dark Mode Support
   ========================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --cw-text: #F2F3F1;
        --cw-text-light: #C7CCC8;
        --cw-border: #2C332F;
        --cw-bg: #1B211E;
        --cw-bg-soft: #222925;
    }

    .cw-consultation-form {
        background: var(--cw-bg);
    }
}
