/**
 * RCS API Integration Styles
 */

/* Admin Styles */
.rcs-api-admin-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.rcs-api-main-content {
    flex: 2;
}

.rcs-api-sidebar {
    flex: 1;
    max-width: 300px;
}

.rcs-api-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.rcs-api-actions .button {
    margin-right: 10px;
    margin-bottom: 10px;
}

.rcs-api-status-card,
.rcs-api-balance-card,
.rcs-api-products-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
}

.rcs-api-status-card h3,
.rcs-api-balance-card h3,
.rcs-api-products-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.unknown {
    background-color: #ddd;
}

.status-indicator.loading {
    background-color: #ffb900;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.success {
    background-color: #00a32a;
}

.status-indicator.error {
    background-color: #d63638;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.balance-amount {
    font-size: 24px;
    font-weight: bold;
    color: #00a32a;
    display: block;
    margin-bottom: 10px;
}

.products-count {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
    display: block;
    margin-bottom: 5px;
}

.products-label {
    font-size: 14px;
    color: #666;
}

#rcs-api-messages {
    margin-top: 20px;
}

/* Product Variation Fields */
.rcs-api-variation-fields {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
}

.rcs-api-variation-fields h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #23282d;
    font-size: 14px;
    font-weight: 600;
}

.rcs-api-variation-fields .form-row {
    margin-bottom: 15px;
}

.rcs-api-variation-fields .form-row-full {
    width: 100%;
}

.rcs-api-variation-fields .form-row-first {
    width: 48%;
    float: left;
    margin-right: 4%;
}

.rcs-api-variation-fields .form-row-last {
    width: 48%;
    float: left;
}

.rcs-api-variation-fields::after {
    content: "";
    display: table;
    clear: both;
}

/* Frontend Styles */
.rcs-api-fields {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rcs-api-fields h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #495057;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #007cba;
    padding-bottom: 10px;
}

.rcs-field-group {
    margin-bottom: 20px;
}

.rcs-field-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.rcs-field-group .required {
    color: #dc3545;
}

.rcs-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.rcs-input:focus {
    border-color: #007cba;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 124, 186, 0.25);
}

.rcs-field-description {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

.rcs-field-group .button {
    margin-left: 10px;
    vertical-align: top;
}

.rcs-status-message {
    margin-top: 10px;
    padding: 10px 15px;
    border-radius: 4px;
    font-weight: 500;
    display: none;
}

.rcs-status-message.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.rcs-status-message.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Add to Cart Button States */
.single_add_to_cart_button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #6c757d !important;
    border-color: #6c757d !important;
}

.single_add_to_cart_button.disabled:hover {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
}

/* Order Meta Box */
.rcs-sync-status {
    font-size: 13px;
}

.rcs-sync-status p {
    margin: 0 0 10px 0;
}

.rcs-sync-status .status-synced {
    color: #00a32a;
    font-weight: 600;
}

.rcs-sync-status .status-pending {
    color: #ffb900;
    font-weight: 600;
}

.rcs-api-orders ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.rcs-api-orders li {
    margin-bottom: 5px;
    font-size: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .rcs-api-admin-container {
        flex-direction: column;
    }

    .rcs-api-sidebar {
        max-width: none;
    }

    .rcs-api-variation-fields .form-row-first,
    .rcs-api-variation-fields .form-row-last {
        width: 100%;
        float: none;
        margin-right: 0;
    }

    .rcs-input {
        max-width: 100%;
    }

    .rcs-field-group .button {
        margin-left: 0;
        margin-top: 10px;
        display: block;
        width: 100%;
        max-width: 200px;
    }
}

/* Loading States */
.rcs-loading {
    position: relative;
    pointer-events: none;
}

.rcs-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Notices */
.notice.rcs-notice {
    margin: 15px 0;
    padding: 12px;
    border-left: 4px solid #007cba;
    background: #f7f7f7;
}

.notice.rcs-notice.notice-success {
    border-left-color: #00a32a;
    background: #f0f8f0;
}

.notice.rcs-notice.notice-error {
    border-left-color: #d63638;
    background: #fdf0f0;
}

/* WooCommerce Integration */
.woocommerce .rcs-api-fields {
    margin: 20px 0;
}

.woocommerce .rcs-api-fields h3 {
    color: #333;
    font-size: 16px;
}

.woocommerce .rcs-field-group label {
    color: #333;
    font-weight: 500;
}

/* Variation Selection Enhancement */
.variations .rcs-api-fields {
    margin-top: 15px;
}

.variations .rcs-api-fields:not(:visible) {
    display: none !important;
}