/* Custom Orders Frontend Styles */

.custom-order-form-container {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
}

.custom-order-form-container h3 {
    margin-top: 0;
    color: #333;
}

.custom-order-description {
    margin-bottom: 20px;
    color: #666;
}

.custom-order-field {
    margin-bottom: 20px;
}

.custom-order-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.custom-order-field .required {
    color: #e74c3c;
}

.custom-order-field input[type="text"],
.custom-order-field input[type="email"],
.custom-order-field input[type="tel"],
.custom-order-field input[type="number"],
.custom-order-field textarea,
.custom-order-field select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    line-height: 1.4;
    background: #fff;
}

.custom-order-field input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
}

.custom-order-field textarea {
    min-height: 100px;
    resize: vertical;
}

/* Radio and checkbox fields */
.custom-order-radio-option,
.custom-order-checkbox-option {
    display: block;
    margin-bottom: 8px;
    font-weight: normal !important;
    cursor: pointer;
}

.custom-order-radio-option input,
.custom-order-checkbox-option input {
    width: auto;
    margin-right: 8px;
    vertical-align: middle;
}

.custom-order-field-radio .custom-order-radio-option,
.custom-order-field-checkbox .custom-order-checkbox-option {
    margin-left: 0;
}

/* File upload info */
.file-types-info {
    display: block;
    margin-top: 5px;
    color: #666;
    font-style: italic;
}

/* Error states */
.field-error {
    border-color: #e74c3c !important;
    background-color: #fdf2f2 !important;
}

.validation-error,
.file-error {
    display: block;
    margin-top: 5px;
    color: #e74c3c;
    font-size: 12px;
}

/* Form actions */
.custom-order-form-actions {
    margin-top: 30px;
    text-align: center;
}

.custom-order-submit {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-order-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Messages */
.custom-order-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 3px;
    font-weight: 600;
}

.custom-order-message.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.custom-order-message.error {
    background-color: #f8d7da;
    border: 1px solid #f1aeb5;
    color: #721c24;
}

/* My Requests */
.custom-orders-my-requests {
    margin: 20px 0;
}

.custom-order-request-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 20px;
    margin-bottom: 15px;
}

.custom-order-request-item h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.custom-order-request-item p {
    margin-bottom: 8px;
    color: #666;
}

/* Status badges */
.custom-orders-status,
[class*="custom-orders-status-"] {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #fff;
}

.custom-orders-status-request_received {
    background-color: #2271b1;
}

.custom-orders-status-quoting {
    background-color: #f56e28;
}

.custom-orders-status-awaiting_payment {
    background-color: #d63638;
}

.custom-orders-status-in_progress {
    background-color: #00a32a;
}

.custom-orders-status-completed {
    background-color: #646970;
}

/* Responsive */
@media (max-width: 768px) {
    .custom-order-form-container {
        margin: 10px 0;
        padding: 15px;
    }
    
    .custom-order-field input[type="text"],
    .custom-order-field input[type="email"],
    .custom-order-field input[type="tel"],
    .custom-order-field input[type="number"],
    .custom-order-field textarea,
    .custom-order-field select {
        padding: 8px;
    }
    
    .custom-order-submit {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
    
    .custom-order-request-item {
        padding: 15px;
    }
}

/* Integration with theme styles */
body.woocommerce .custom-order-form-container,
body.woocommerce-page .custom-order-form-container {
    font-family: inherit;
}

/* WooCommerce button styling override */
.woocommerce .custom-order-submit.button.alt,
.woocommerce-page .custom-order-submit.button.alt {
    background-color: #0073aa;
    color: #fff;
}

.woocommerce .custom-order-submit.button.alt:hover,
.woocommerce-page .custom-order-submit.button.alt:hover {
    background-color: #005177;
}

/* Messaging Styles */
.custom-orders-messages-container {
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
}

.custom-orders-messages-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
}

.custom-orders-message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 8px;
    position: relative;
    border-left: 4px solid transparent;
}

.custom-orders-message.customer-message {
    background-color: #f8f9fa;
    border-left-color: #0073aa;
    margin-right: 20%;
}

.custom-orders-message.admin-message {
    background-color: #e3f2fd;
    border-left-color: #2196f3;
    margin-left: 20%;
}

.custom-orders-message.own-message {
    background-color: #e8f5e8;
    border-left-color: #4caf50;
}

.custom-orders-message.unread {
    border-left-color: #ff9800;
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.2);
}

.custom-orders-message-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.custom-orders-message-author {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.custom-orders-message-badge {
    background: #0073aa;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.custom-orders-message-badge.admin-badge {
    background: #d63638;
}

.custom-orders-message-date {
    color: #666;
    font-size: 12px;
    margin-left: auto;
}

.custom-orders-message-content {
    color: #333;
    line-height: 1.5;
    font-size: 14px;
}

.custom-orders-message-content p {
    margin: 0 0 8px 0;
}

.custom-orders-message-content p:last-child {
    margin-bottom: 0;
}

/* Chat Disabled Message */
.custom-orders-chat-disabled {
    border-top: 1px solid #ddd;
    padding: 15px;
    background: #f8f9fa;
}

.custom-orders-chat-disabled p {
    margin: 0;
    padding: 10px 15px;
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    color: #0c5460;
    font-size: 14px;
}

.custom-orders-message-form {
    border-top: 1px solid #ddd;
    padding: 15px;
    background: #f8f9fa;
}

.custom-orders-message-form h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

.custom-orders-message-form .form-group {
    margin-bottom: 15px;
}

.custom-orders-message-form textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
}

.custom-orders-message-form textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.custom-orders-message-form .form-actions {
    text-align: right;
}

.custom-orders-message-form .button {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.custom-orders-message-form .button:hover {
    background: #005177;
}

.custom-orders-message-form .button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.custom-orders-message-summary {
    padding: 10px 15px;
    background: #f1f1f1;
    border-top: 1px solid #ddd;
    font-size: 12px;
    color: #666;
}

.custom-orders-no-messages {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Unread count badge */
.unread-count {
    background: #ff9800;
    color: #fff;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 5px;
}

/* Request details messaging */
.custom-orders-request-messages {
    margin-top: 30px;
    border-top: 2px solid #f1f1f1;
    padding-top: 20px;
}

.custom-orders-request-messages h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 18px;
}

/* Responsive messaging */
@media (max-width: 768px) {
    .custom-orders-message.customer-message,
    .custom-orders-message.admin-message {
        margin-right: 0;
        margin-left: 0;
    }
    
    .custom-orders-message-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .custom-orders-message-date {
        margin-left: 0;
    }
    
    .custom-orders-messages-list {
        max-height: 300px;
        padding: 10px;
    }
    
    .custom-orders-message-form {
        padding: 10px;
    }
}

/* Notice styles */
.custom-orders-notice {
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-orders-notice-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.custom-orders-notice-error {
    background-color: #f8d7da;
    border: 1px solid #f1aeb5;
    color: #721c24;
}

.custom-orders-notice p {
    margin: 0;
    flex: 1;
}

.custom-orders-notice-dismiss {
    background: none;
    border: none;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    color: inherit;
    opacity: 0.7;
}

.custom-orders-notice-dismiss:hover {
    opacity: 1;
}

/* Block Checkout Field Styling Fixes */
.wc-block-checkout .wc-block-components-text-input.filled label,
.wc-block-checkout .wc-block-components-text-input.has-value label,
.wc-block-checkout .wc-block-components-text-input--filled label {
    transform: translateY(-50%) scale(0.75) !important;
    opacity: 0.7 !important;
}

.wc-block-checkout input.filled,
.wc-block-checkout input.has-value {
    padding-top: 1.5em !important;
}

/* Ensure proper label positioning for filled fields */
.wc-block-components-text-input input:not(:placeholder-shown) + label,
.wc-block-components-text-input input.filled + label,
.wc-block-components-text-input input.has-value + label {
    transform: translateY(-50%) scale(0.75);
    opacity: 0.7;
}

/* Handle Material Design style inputs */
.wc-block-checkout .components-text-control__input.filled,
.wc-block-checkout .components-text-control__input.has-value {
    border-color: #ddd;
}

/* Fix for floating labels that might overlap */
.wc-block-checkout .wc-block-components-text-input .wc-block-components-text-input__label {
    pointer-events: none;
    transition: all 0.2s ease-in-out;
}

/* Specific fixes for email field overlapping */
.wc-block-checkout input[type="email"].filled ~ label,
.wc-block-checkout input[type="email"].has-value ~ label,
.wc-block-checkout input[type="email"]:not(:placeholder-shown) ~ label {
    position: absolute !important;
    top: 0 !important;
    left: 12px !important;
    transform: translateY(-50%) scale(0.75) !important;
    background: white !important;
    padding: 0 4px !important;
    z-index: 1 !important;
}

/* File Upload Styles for Frontend Messages */
.custom-orders-frontend-message-form .file-upload-group {
    margin-top: 15px;
}

.custom-orders-frontend-message-form .file-upload-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.custom-orders-frontend-message-form input[type="file"] {

}

.custom-orders-frontend-message-form .file-preview {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 3px;
    min-height: 20px;
}

.custom-orders-frontend-message-form .file-preview:empty {
    display: none;
}

.custom-orders-frontend-message-form .file-preview-item {
    display: flex;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #e9ecef;
}

.custom-orders-frontend-message-form .file-preview-item:last-child {
    border-bottom: none;
}

.custom-orders-frontend-message-form .file-name {
    font-weight: 500;
    color: #333;
}

.custom-orders-frontend-message-form .file-size {
    color: #666;
    font-size: 12px;
}

/* Message Attachments Display */
.custom-orders-message-attachments {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.custom-orders-message-attachments h5 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.custom-orders-message-attachments .attachment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.custom-orders-message-attachments .attachment-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

.custom-orders-message-attachments .attachment-item:last-child {
    border-bottom: none;
}

.custom-orders-message-attachments .attachment-preview {
    margin-right: 10px;
    flex-shrink: 0;
}

.custom-orders-message-attachments .attachment-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 3px;
}

.custom-orders-message-attachments .attachment-info {
    flex-grow: 1;
}

.custom-orders-message-attachments .attachment-link {
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
}

.custom-orders-message-attachments .attachment-link:hover {
    text-decoration: underline;
}

.custom-orders-message-attachments .attachment-size {
    color: #666;
    font-size: 12px;
    margin-left: 5px;
}

/* File Upload Notices */
.custom-orders-notice {
    position: relative;
    padding: 12px 16px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 14px;
}

.custom-orders-notice-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.custom-orders-notice-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.custom-orders-notice-dismiss {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
}

.custom-orders-notice-dismiss:hover {
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .custom-orders-message-attachments .attachment-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .custom-orders-message-attachments .attachment-preview {
        margin-right: 0;
        margin-bottom: 8px;
    }
}