/**
 * Textarea Atom Styles
 * 
 * Professional textarea styling following Atomic Design principles.
 * Matches Input atom styling for consistency.
 * 
 * @package Mendene_Location
 * @subpackage CSS\Atoms
 * @version 1.0.0
 */

/* ============================================
   BASE TEXTAREA STYLES
   ============================================ */

.textarea {
    width: 100%;
    font-family: 'Avenir', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #1a1a1a;
    background-color: transparent;
    border: none;
    outline: none;
    resize: vertical;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    min-height: 120px;
}

.textarea::placeholder {
    color: #999;
    opacity: 1;
    transition: color 0.3s ease;
}

.textarea:focus::placeholder {
    color: #bbb;
}

/* ============================================
   TEXTAREA VARIANTS
   ============================================ */

/* Outlined Variant (Default for forms) */
.textarea--outlined {
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background-color: #ffffff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.textarea--outlined:hover:not(:disabled):not(.textarea--disabled) {
    border-color: #b0b0b0;
}

.textarea--outlined:focus {
    border-color: #7D4096;
    box-shadow: 0 0 0 4px rgba(125, 64, 150, 0.1);
    outline: none;
}

.textarea--outlined.textarea--error {
    border-color: #e74c3c;
}

.textarea--outlined.textarea--error:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1);
}

.textarea--outlined.textarea--success {
    border-color: #27ae60;
}

.textarea--outlined.textarea--success:focus {
    border-color: #27ae60;
    box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.1);
}

/* Filled Variant */
.textarea--filled {
    padding: 14px 18px;
    border: none;
    border-bottom: 2px solid #e0e0e0;
    border-radius: 12px 12px 0 0;
    background-color: #f5f5f5;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.textarea--filled:hover:not(:disabled):not(.textarea--disabled) {
    background-color: #eeeeee;
    border-bottom-color: #b0b0b0;
}

.textarea--filled:focus {
    background-color: #ffffff;
    border-bottom-color: #7D4096;
    box-shadow: 0 2px 8px rgba(125, 64, 150, 0.1);
}

.textarea--filled.textarea--error {
    border-bottom-color: #e74c3c;
}

.textarea--filled.textarea--success {
    border-bottom-color: #27ae60;
}

/* Default Variant */
.textarea--default {
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #ffffff;
}

.textarea--default:focus {
    border-color: #7D4096;
    box-shadow: 0 0 0 3px rgba(125, 64, 150, 0.1);
}

/* ============================================
   TEXTAREA SIZES
   ============================================ */

.textarea--small {
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 10px;
    min-height: 100px;
}

.textarea--medium {
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 12px;
    min-height: 120px;
}

.textarea--large {
    padding: 16px 20px;
    font-size: 18px;
    border-radius: 14px;
    min-height: 150px;
}

.textarea--large.textarea--outlined {
    padding: 16px 20px;
}

/* ============================================
   TEXTAREA STATES
   ============================================ */

.textarea--disabled,
.textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f5f5f5;
    pointer-events: none;
    resize: none;
}

.textarea--error {
    color: #e74c3c;
}

.textarea--success {
    color: #27ae60;
}

/* ============================================
   TEXTAREA CONTAINER
   ============================================ */

.textarea-container {
    margin-bottom: 24px;
    width: 100%;
}

.textarea-container--error {
    margin-bottom: 28px;
}

/* ============================================
   TEXTAREA LABEL
   ============================================ */

.textarea__label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    transition: color 0.3s ease;
    line-height: 1.4;
}

.textarea-container:focus-within .textarea__label {
    color: #7D4096;
}

.textarea-container--error .textarea__label {
    color: #e74c3c;
}

.textarea-container--error:focus-within .textarea__label {
    color: #e74c3c;
}

/* Required Indicator */
.textarea__required {
    color: #7D4096;
    font-weight: 700;
    margin-left: 2px;
}

.textarea-container--error .textarea__required {
    color: #e74c3c;
}

/* ============================================
   TEXTAREA ERROR MESSAGE
   ============================================ */

.textarea__error {
    display: block;
    font-size: 13px;
    color: #e74c3c;
    margin-top: 6px;
    line-height: 1.4;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   TEXTAREA SUCCESS STATE
   ============================================ */

.textarea-container--success .textarea__label {
    color: #27ae60;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .textarea--large {
        padding: 14px 18px;
        font-size: 16px;
        min-height: 130px;
    }
    
    .textarea--outlined {
        border-radius: 10px;
    }
    
    .textarea__label {
        font-size: 14px;
    }
    
    .textarea-container {
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .textarea--large {
        padding: 12px 16px;
        min-height: 120px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.textarea:focus-visible {
    outline: 2px solid #7D4096;
    outline-offset: 2px;
}

.textarea--error:focus-visible {
    outline-color: #e74c3c;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .textarea--outlined {
        border-width: 3px;
    }
    
    .textarea:focus {
        outline: 3px solid #7D4096;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .textarea,
    .textarea__label,
    .textarea__error {
        transition: none;
    }
    
    .textarea__error {
        animation: none;
    }
}

