/**
 * Shelley WooCommerce PO Gateway - Styles
 * Custom styling for the PO gateway checkout interface
 */

/* PO Gateway Fields Container */
#shelley_po_fields {
    margin: 15px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #f9f9f9;
}

#shelley_po_fields .po-number-field,
#shelley_po_fields .po-file-field {
    margin-bottom: 20px;
}

#shelley_po_fields .po-number-field:last-child,
#shelley_po_fields .po-file-field:last-child {
    margin-bottom: 0;
}

/* Labels */
#shelley_po_fields label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

#shelley_po_fields label .required {
    color: #dc3232;
    font-weight: bold;
}

/* Description text */
#shelley_po_fields .description {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* PO Number Input */
#po_number {
    width: 100%;
    max-width: 300px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#po_number:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

#po_number.po-field-invalid {
    border-color: #dc3232;
    box-shadow: 0 0 0 1px #dc3232;
}

/* File Upload Input */
#po_upload {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    width: 100%;
    height: auto !important;
    padding: 12px;
    border: 2px dashed #ccc;
    border-radius: 6px;
    background-color: #fff;
    font-size: 14px;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    cursor: pointer;
}

#po_upload:hover {
    border-color: #999;
    background-color: #fafafa;
}

#po_upload:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

#po_upload.po-field-invalid {
    border-color: #dc3232;
    background-color: #fef7f7;
}

/* Drag and Drop States */
#po_upload.po-drag-over {
    border-color: #007cba;
    background-color: #f0f8ff;
}

/* File Size Info */
.file-size-info {
    margin: 5px 0 0 0;
}

.file-size-info small {
    color: #666;
    font-size: 12px;
}

/* File Upload Status */
#po_upload_status {
    margin-top: 10px;
    min-height: 20px;
    font-size: 13px;
    line-height: 1.4;
}

/* Upload Status Messages */
.po-upload-success {
    color: #46b450;
    font-weight: 500;
}

.po-upload-error {
    color: #dc3232;
    font-weight: 500;
}

.po-upload-progress {
    color: #0073aa;
    font-style: italic;
}

/* Field Error Messages */
.field-error {
    margin-top: 5px;
}

.po-field-error {
    color: #dc3232;
    font-size: 12px;
    font-weight: 500;
    display: block;
}

/* Admin Order List - PO Columns */
.wp-admin .column-po_number {
    width: 120px;
}

.wp-admin .column-po_file {
    width: 120px;
}

.wp-admin .column-po_number,
.wp-admin .column-po_file {
    text-align: left;
}

.wp-admin .column-po_file a {
    color: #0073aa;
    text-decoration: none;
}

.wp-admin .column-po_file a:hover {
    color: #005a87;
    text-decoration: underline;
}

/* Admin Order Edit Page */
.woocommerce_admin_order_data_after_billing_address .address h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.woocommerce_admin_order_data_after_billing_address .address {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.woocommerce_admin_order_data_after_billing_address .address p {
    margin: 0 0 10px 0;
}

.woocommerce_admin_order_data_after_billing_address .address p:last-child {
    margin-bottom: 0;
}

.woocommerce_admin_order_data_after_billing_address .address strong {
    display: inline-block;
    min-width: 80px;
    font-weight: 600;
}

.woocommerce_admin_order_data_after_billing_address .address a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.woocommerce_admin_order_data_after_billing_address .address a:hover {
    color: #005a87;
    text-decoration: underline;
}

/* Thank You Page */
.woocommerce-message {
    margin: 20px 0;
    padding: 15px;
    background-color: #f0f8ff;
    border: 1px solid #007cba;
    border-radius: 4px;
}

.woocommerce-message p {
    margin: 0 0 10px 0;
}

.woocommerce-message p:last-child {
    margin-bottom: 0;
}

.woocommerce-message strong {
    font-weight: 600;
}

.woocommerce-message a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.woocommerce-message a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    #shelley_po_fields {
        margin: 10px 0;
        padding: 15px;
    }
    
    #po_number {
        max-width: 100%;
        padding: 8px 10px;
        font-size: 13px;
    }
    
    #po_upload {
        padding: 10px;
        font-size: 13px;
    }
    
    #po_upload_status {
        font-size: 12px;
    }
    
    .po-field-error {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    #shelley_po_fields {
        padding: 12px;
    }
    
    #shelley_po_fields label {
        font-size: 13px;
    }
    
    #po_number {
        padding: 8px;
        font-size: 12px;
    }
    
    #po_upload {
        padding: 8px;
        font-size: 12px;
    }
}

/* Loading Animation */
.po-upload-progress::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 5px;
    border: 2px solid #0073aa;
    border-radius: 50%;
    border-top-color: transparent;
    animation: po-spin 1s linear infinite;
}

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

/* Accessibility Improvements */
#po_number:focus,
#po_upload:focus {
    outline: 2px solid #005a87;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    #shelley_po_fields {
        border-color: #000;
        background-color: #fff;
    }
    
    #po_number,
    #po_upload {
        border-color: #000;
    }
    
    .po-upload-success {
        color: #00a000;
    }
    
    .po-upload-error,
    .po-field-error {
        color: #cc0000;
    }
    
    #po_number.po-field-invalid,
    #po_upload.po-field-invalid {
        border-color: #cc0000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    #po_number,
    #po_upload {
        transition: none;
    }
    
    .po-upload-progress::after {
        animation: none;
    }
}

/* Print Styles */
@media print {
    #shelley_po_fields {
        border: 1px solid #000;
        background-color: transparent;
    }
    
    .po-upload-progress::after {
        display: none;
    }
}