/**
 * DSI Quotes Manager - Send Message Form CSS
 * Additional styles for customer message sending
 */

/* ============================================
   Send Message Form Container
   ============================================ */
.send-message-form {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.send-message-form .form-header {
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #dee2e6;
}

.send-message-form .form-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.send-message-form .form-header .material-icons {
    color: #119fb4;
    font-size: 24px;
}

/* ============================================
   Form Elements
   ============================================ */
.message-form .form-group {
    margin-bottom: 15px;
}

.message-form label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: block;
    font-size: 0.95rem;
}

.message-form label .required {
    color: #dc3545;
    margin-left: 4px;
}

.message-form textarea.form-control {
    border: 2px solid #ced4da;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 100px;
}

.message-form textarea.form-control:focus {
    border-color: #119fb4;
    box-shadow: 0 0 0 0.2rem rgba(17, 159, 180, 0.25);
    outline: none;
}

.message-form textarea.form-control::placeholder {
    color: #adb5bd;
    font-style: italic;
}

/* Character Counter */
.form-text {
    display: flex;
    justify-content: flex-end;
    margin-top: 5px;
}

#char-counter {
    font-weight: 600;
    color: #119fb4;
}

#char-counter.warning {
    color: #ffc107;
}

#char-counter.danger {
    color: #dc3545;
}

/* ============================================
   Form Actions (Buttons)
   ============================================ */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.btn-send-message {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #119fb4 0%, #0d7a8a 100%);
    border: none;
    color: white;
}

.btn-send-message:hover {
    background: linear-gradient(135deg, #0d7a8a 0%, #095c6b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(17, 159, 180, 0.4);
}

.btn-send-message:active {
    transform: translateY(0);
}

.btn-send-message .material-icons {
    font-size: 20px;
}

.btn-send-message:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-cancel-message {
    padding: 12px 24px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-cancel-message .material-icons {
    font-size: 20px;
}

/* ============================================
   Loading State
   ============================================ */
.btn-send-message.loading {
    position: relative;
    pointer-events: none;
    color: transparent;
}

.btn-send-message.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Message Feedback (Success/Error)
   ============================================ */
.message-feedback {
    margin-top: 15px;
    animation: slideDown 0.3s ease-out;
}

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

.message-feedback .alert {
    margin-bottom: 0;
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-feedback .alert::before {
    font-family: 'Material Icons';
    font-size: 24px;
}

.message-feedback .alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.message-feedback .alert-success::before {
    content: 'check_circle';
    color: #28a745;
}

.message-feedback .alert-danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.message-feedback .alert-danger::before {
    content: 'error';
    color: #dc3545;
}

/* ============================================
   Message Sent Animation
   ============================================ */
.message-item.just-sent {
    animation: messageSlideInHighlight 0.6s ease-out;
}

@keyframes messageSlideInHighlight {
    0% {
        opacity: 0;
        transform: translateX(-30px) scale(0.95);
        background: #d4edda;
    }
    50% {
        background: #d4edda;
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
        background: transparent;
    }
}

/* ============================================
   Divider Between Form and Timeline
   ============================================ */
.messages-timeline {
    border-top: 2px solid #dee2e6;
    padding-top: 20px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .send-message-form {
        padding: 15px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-send-message,
    .btn-cancel-message {
        width: 100%;
    }
    
    .message-form textarea.form-control {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* ============================================
   Empty State Enhancement
   ============================================ */
.no-messages-placeholder {
    margin-top: 20px;
    border-top: 2px solid #dee2e6;
    padding-top: 40px;
}

/* ============================================
   Focus Management
   ============================================ */
.message-form textarea.form-control:invalid:not(:placeholder-shown) {
    border-color: #dc3545;
}

.message-form textarea.form-control:valid:not(:placeholder-shown) {
    border-color: #28a745;
}

/* ============================================
   Accessibility
   ============================================ */
.btn-send-message:focus,
.btn-cancel-message:focus,
.message-form textarea.form-control:focus {
    outline: 3px solid rgba(17, 159, 180, 0.4);
    outline-offset: 2px;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .send-message-form {
        display: none !important;
    }
    
    .message-feedback {
        display: none !important;
    }
}
