/* WooCommerce Atiendia Assistant - Admin Styles */

.wc-atiendia-admin {
    max-width: 800px;
}

/* ── Status badges ─────────────────────────────────────────────── */
.atiendiaw-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}
.atiendiaw-badge-success  { background: #d1fae5; color: #065f46; }
.atiendiaw-badge-error    { background: #fee2e2; color: #991b1b; }
.atiendiaw-badge-running  { background: #fef9c3; color: #854d0e; }
.atiendiaw-badge-pending  { background: #e0e7ff; color: #3730a3; }
.atiendiaw-badge-queued   { background: #e0e7ff; color: #3730a3; }
.atiendiaw-badge-never    { background: #f3f4f6; color: #6b7280; }
.atiendiaw-badge-unknown  { background: #f3f4f6; color: #6b7280; }

/* ── Registration status chip ────────────────────────────────── */
.wc-atiendia-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}
.wc-atiendia-status.registered {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.wc-atiendia-status.not-registered {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.wc-atiendia-register-button {
    position: relative;
}
.wc-atiendia-register-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.wc-atiendia-register-button.loading::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: wc-atiendia-spin 1s linear infinite;
}
@keyframes wc-atiendia-spin {
    0%   { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* ── Form table ──────────────────────────────────────────────────── */
.wc-atiendia-form-table th {
    width: 200px;
    padding: 20px 10px 20px 0;
    vertical-align: top;
}
.wc-atiendia-form-table td {
    padding: 15px 10px;
}
.wc-atiendia-form-table input[type="text"],
.wc-atiendia-form-table input[type="email"],
.wc-atiendia-form-table input[type="url"],
.wc-atiendia-form-table input[type="password"],
.wc-atiendia-form-table select {
    width: 100%;
    max-width: 400px;
}
.wc-atiendia-form-table input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* ── Notices ───────────────────────────────────────────────────── */
.wc-atiendia-description {
    font-style: italic;
    color: #666;
    margin-top: 5px;
}
.wc-atiendia-notice {
    margin: 20px 0;
    padding: 12px;
    border-left: 4px solid #00a0d2;
    background: #f7f7f7;
}
.wc-atiendia-notice.success { border-left-color: #46b450; background: #f0f8ff; }
.wc-atiendia-notice.error   { border-left-color: #dc3232; background: #fff5f5; }
.wc-atiendia-notice.warning { border-left-color: #ffb900; background: #fffbf0; }

/* ── Sync section ────────────────────────────────────────────────── */
#atiendiaw-sync-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 14px;
    min-height: 24px;
}

.wc-atiendia-sync-indicator {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background-color: #d1d5db;
    flex-shrink: 0;
}
.wc-atiendia-sync-indicator.success { background-color: #22c55e; }
.wc-atiendia-sync-indicator.error   { background-color: #ef4444; }
.wc-atiendia-sync-indicator.running,
.wc-atiendia-sync-indicator.pending,
.wc-atiendia-sync-indicator.queued  {
    background-color: #f59e0b;
    animation: wc-atiendia-pulse 1s ease-in-out infinite alternate;
}
@keyframes wc-atiendia-pulse {
    from { opacity: 1; }
    to   { opacity: 0.4; }
}

/* ── Sync history table ───────────────────────────────────────────── */
#atiendiaw-sync-history th,
#atiendiaw-sync-history td {
    vertical-align: middle;
}
#atiendiaw-sync-history td:nth-child(3) { text-align: center; }
#atiendiaw-sync-history td:nth-child(4) { font-size: 12px; color: #6b7280; }

/* ── Danger zone ──────────────────────────────────────────────────── */
.atiendiaw-danger-zone {
    margin: 24px 0 0;
    padding: 16px 20px;
    border: 1px solid #fca5a5;
    border-left: 4px solid #ef4444;
    border-radius: 4px;
    background: #fff5f5;
}
.atiendiaw-danger-zone h2 {
    margin: 0 0 6px;
    font-size: 14px;
    color: #991b1b;
}
.atiendiaw-danger-zone p {
    margin: 0 0 12px;
    color: #555;
    font-size: 13px;
}
#atiendia-reset-btn {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}
#atiendia-reset-btn:hover {
    background: #ef4444 !important;
    color: #fff !important;
}

/* ── Metrics grid ─────────────────────────────────────────────────── */
.wc-atiendia-section {
    margin: 30px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}
.wc-atiendia-section h3 {
    margin-top: 0;
    color: #23282d;
}
.wc-atiendia-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}
.wc-atiendia-metric {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    background: #f9f9f9;
}
.wc-atiendia-metric-value {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
    display: block;
}
.wc-atiendia-metric-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-top: 5px;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .wc-atiendia-form-table th,
    .wc-atiendia-form-table td {
        display: block;
        width: 100%;
        padding: 10px 0;
    }
    .wc-atiendia-metrics {
        grid-template-columns: 1fr;
    }
}


.wc-atiendia-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.wc-atiendia-status.registered {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wc-atiendia-status.not-registered {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.wc-atiendia-register-button {
    position: relative;
}

.wc-atiendia-register-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wc-atiendia-register-button.loading::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: wc-atiendia-spin 1s linear infinite;
}

@keyframes wc-atiendia-spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

.wc-atiendia-form-table th {
    width: 200px;
    padding: 20px 10px 20px 0;
    vertical-align: top;
}

.wc-atiendia-form-table td {
    padding: 15px 10px;
}

.wc-atiendia-form-table input[type="text"],
.wc-atiendia-form-table input[type="email"],
.wc-atiendia-form-table input[type="url"],
.wc-atiendia-form-table input[type="password"],
.wc-atiendia-form-table select {
    width: 100%;
    max-width: 400px;
}

.wc-atiendia-form-table input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.wc-atiendia-description {
    font-style: italic;
    color: #666;
    margin-top: 5px;
}

.wc-atiendia-notice {
    margin: 20px 0;
    padding: 12px;
    border-left: 4px solid #00a0d2;
    background: #f7f7f7;
}

.wc-atiendia-notice.success {
    border-left-color: #46b450;
    background: #f0f8ff;
}

.wc-atiendia-notice.error {
    border-left-color: #dc3232;
    background: #fff5f5;
}

.wc-atiendia-notice.warning {
    border-left-color: #ffb900;
    background: #fffbf0;
}

.wc-atiendia-section {
    margin: 30px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.wc-atiendia-section h3 {
    margin-top: 0;
    color: #23282d;
}

.wc-atiendia-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.wc-atiendia-metric {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    background: #f9f9f9;
}

.wc-atiendia-metric-value {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
    display: block;
}

.wc-atiendia-metric-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-top: 5px;
}

.wc-atiendia-sync-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.wc-atiendia-sync-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ccc;
}

.wc-atiendia-sync-indicator.success {
    background-color: #46b450;
}

.wc-atiendia-sync-indicator.error {
    background-color: #dc3232;
}

.wc-atiendia-sync-indicator.running {
    background-color: #ffb900;
    animation: wc-atiendia-pulse 1s ease-in-out infinite alternate;
}

@keyframes wc-atiendia-pulse {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

/* Responsive design */
@media (max-width: 768px) {
    .wc-atiendia-form-table th,
    .wc-atiendia-form-table td {
        display: block;
        width: 100%;
        padding: 10px 0;
    }
    
    .wc-atiendia-metrics {
        grid-template-columns: 1fr;
    }
}
