/**
 * WPCD Unified UI Components
 *
 * Consolidated component styles matching unified-shortcode-ui.html mockup.
 * This file provides consistent styling for:
 * - Buttons
 * - Toasts/Notifications
 * - Modals/Dialogs
 * - Terminal/Console
 * - Forms
 * - Notices/Alerts
 * - Loading states
 *
 * IMPORTANT: This file depends on wpcd-theme-variables.css for color definitions.
 * Load wpcd-theme-variables.css BEFORE this file.
 *
 * @package WPCD
 * @version 2.0.0
 */

/* ========== GLASS BUTTON SYSTEM ========== */
/*
 * Modern frosted glass buttons with backdrop blur.
 * Buttons start translucent and fill solid on hover.
 */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: var(--btn-padding-md);
    font-size: var(--btn-font-md);
    font-weight: 500;
    border-radius: var(--btn-radius);
    border: 1px solid var(--glass-border);
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
    line-height: 1.4;
    white-space: nowrap;
}

.btn:hover {
    background: var(--glass-hover);
    border-color: var(--glass-border-hover);
    color: var(--text);
    transform: translateY(-1px);
}

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

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

/* Sizes */
.btn-sm {
    padding: var(--btn-padding-sm);
    font-size: var(--btn-font-sm);
}

.btn-lg {
    padding: var(--btn-padding-lg);
    font-size: var(--btn-font-lg);
}

/* Primary - Glass with blue tint, fills solid on hover */
.btn-primary {
    background: var(--accent-bg);
    border-color: var(--accent-border);
    color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

/* Success */
.btn-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
}

.btn-success:hover {
    background: var(--success);
    border-color: var(--success);
    color: var(--text-on-success);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

/* Danger */
.btn-danger {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--text-on-danger);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

/* Warning */
.btn-warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning);
}

.btn-warning:hover {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

/* Info */
.btn-info {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info);
}

.btn-info:hover {
    background: var(--info);
    border-color: var(--info);
    color: #fff;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3);
}

/* Ghost - No border, subtle */
.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
    backdrop-filter: none;
}

.btn-ghost:hover {
    background: var(--glass);
    border-color: transparent;
    color: var(--text);
}

/* Solid - Inverted for maximum emphasis */
.btn-solid {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg-body);
    backdrop-filter: none;
}

.btn-solid:hover {
    background: var(--text-dim);
    border-color: var(--text-dim);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Icon only button */
.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

.btn-icon.btn-lg {
    width: 44px;
    height: 44px;
}

/* Loading state */
.btn-loading {
    pointer-events: none;
    opacity: 0.6;
    cursor: wait;
}

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

/* ========== TAB CONTENT BUTTON STYLES ========== */
/*
 * Glass-style buttons inside tab content areas only.
 * Scoped to .wpcd-custom-tab-content to avoid polluting nav, toggles, etc.
 * No wildcards, no !important — clean specificity.
 */

/* Base glass button — applied via container scope */
.wpcd-custom-tab-content button[class*="wpcd-"][class*="-btn"],
.wpcd-custom-tab-content .btn,
.rwmb-tab-panels button[class*="wpcd-"][class*="-btn"],
.rwmb-tab-panels .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: var(--btn-padding-md, 9px 18px);
    font-size: var(--btn-font-md, 13px);
    font-weight: 500;
    border-radius: var(--btn-radius, 8px);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    background: var(--glass, rgba(255, 255, 255, 0.03));
    color: var(--text-dim, #d4d4d8);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.wpcd-custom-tab-content button[class*="wpcd-"][class*="-btn"]:hover,
.wpcd-custom-tab-content .btn:hover,
.rwmb-tab-panels button[class*="wpcd-"][class*="-btn"]:hover,
.rwmb-tab-panels .btn:hover {
    background: var(--glass-hover, rgba(255, 255, 255, 0.06));
    border-color: var(--glass-border-hover, rgba(255, 255, 255, 0.12));
    color: var(--text, #f4f4f5);
    transform: translateY(-1px);
}

/* Primary variant */
.wpcd-custom-tab-content .primary,
.rwmb-tab-panels .primary,
.btn-primary {
    background: var(--accent-bg, rgba(59, 130, 246, 0.12));
    border-color: var(--accent-border, rgba(59, 130, 246, 0.25));
    color: var(--accent, #3b82f6);
}
.wpcd-custom-tab-content .primary:hover,
.rwmb-tab-panels .primary:hover,
.btn-primary:hover {
    background: var(--accent, #3b82f6);
    border-color: var(--accent, #3b82f6);
    color: var(--text-on-accent, #ffffff);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

/* Danger/Delete variant */
.wpcd-custom-tab-content .danger,
.wpcd-custom-tab-content .delete,
.rwmb-tab-panels .danger {
    background: var(--danger-bg, rgba(239, 68, 68, 0.12));
    border-color: var(--danger-border, rgba(239, 68, 68, 0.25));
    color: var(--danger, #ef4444);
}
.wpcd-custom-tab-content .danger:hover,
.wpcd-custom-tab-content .delete:hover,
.rwmb-tab-panels .danger:hover {
    background: var(--danger, #ef4444);
    border-color: var(--danger, #ef4444);
    color: var(--text-on-danger, #ffffff);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

/* Success variant */
.wpcd-custom-tab-content .success,
.rwmb-tab-panels .success {
    background: var(--success-bg, rgba(16, 185, 129, 0.12));
    border-color: var(--success-border, rgba(16, 185, 129, 0.25));
    color: var(--success, #10b981);
}
.wpcd-custom-tab-content .success:hover,
.rwmb-tab-panels .success:hover {
    background: var(--success, #10b981);
    border-color: var(--success, #10b981);
    color: var(--text-on-success, #ffffff);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

/* Warning variant */
.wpcd-custom-tab-content .warning,
.rwmb-tab-panels .warning {
    background: var(--warning-bg, rgba(245, 158, 11, 0.12));
    border-color: var(--warning-border, rgba(245, 158, 11, 0.25));
    color: var(--warning, #f59e0b);
}
.wpcd-custom-tab-content .warning:hover,
.rwmb-tab-panels .warning:hover {
    background: var(--warning, #f59e0b);
    border-color: var(--warning, #f59e0b);
    color: #fff;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

/* Secondary variant */
.wpcd-custom-tab-content .secondary,
.rwmb-tab-panels .secondary {
    background: var(--glass, rgba(255, 255, 255, 0.03));
    border-color: var(--glass-border, rgba(255, 255, 255, 0.08));
    color: var(--text-muted, #a1a1aa);
}
.wpcd-custom-tab-content .secondary:hover,
.rwmb-tab-panels .secondary:hover {
    background: var(--glass-hover, rgba(255, 255, 255, 0.06));
    border-color: var(--accent, #3b82f6);
    color: var(--accent, #3b82f6);
}

/* Small button variant */
.wpcd-custom-tab-content .small,
.wpcd-custom-tab-content .btn-sm,
.rwmb-tab-panels .small {
    padding: var(--btn-padding-sm, 7px 14px);
    font-size: var(--btn-font-sm, 12px);
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100000;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    max-width: 420px;
    animation: wpcd-slide-in-right 0.3s ease;
    pointer-events: all;
}

@keyframes wpcd-slide-in-right {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    background: var(--success-bg);
    color: var(--success);
}

.toast.error .toast-icon,
.toast.danger .toast-icon {
    background: var(--danger-bg);
    color: var(--danger);
}

.toast.warning .toast-icon {
    background: var(--warning-bg);
    color: var(--warning);
}

.toast.info .toast-icon {
    background: var(--accent-bg);
    color: var(--accent);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.toast-message {
    font-size: 13px;
    color: var(--text-muted);
}

.toast-close {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.toast-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* Toast exit animation */
.toast-exit {
    animation: wpcd-slide-out-right 0.3s ease forwards;
}

@keyframes wpcd-slide-out-right {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ========== MODAL/DIALOG ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 560px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(20px);
    transition: all var(--transition-slow);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-title i {
    font-size: 20px;
}

.modal-title.modal-warning i { color: var(--warning); }
.modal-title.modal-danger i { color: var(--danger); }
.modal-title.modal-success i { color: var(--success); }
.modal-title.modal-info i { color: var(--accent); }

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all var(--transition-normal);
}

.modal-close:hover {
    background: var(--bg-active);
    color: var(--text);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 18px 24px;
    background: var(--bg-hover);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Modal sizes */
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }
.modal-fullscreen { max-width: calc(100vw - 40px); max-height: calc(100vh - 40px); }

/* ========== TERMINAL/CONSOLE ========== */
/* Floating terminal console (macOS-style, draggable) */
.terminal-console,
.terminal {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 600px;
    max-width: calc(100vw - 40px);
    background: #0f0f12;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    max-height: 450px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.terminal-console.minimized,
.terminal.minimized {
    max-height: 44px;
    overflow: hidden;
}

.terminal-console.closing,
.terminal.closing {
    transform: scale(0.95);
    opacity: 0;
}

/* Terminal Header with macOS dots */
.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #16161a;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.terminal-dots {
    display: flex;
    gap: 8px;
}

.terminal-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.terminal-dots span:hover {
    transform: scale(1.1);
}

.terminal-dot-close { background: #ff5f56; }
.terminal-dot-close:hover { background: #ff3b30; }
.terminal-dot-minimize { background: #ffbd2e; }
.terminal-dot-minimize:hover { background: #ff9500; }
.terminal-dot-maximize { background: #27c93f; }
.terminal-dot-maximize:hover { background: #34c759; }

/* Legacy dot classes */
.terminal-dot { width: 12px; height: 12px; border-radius: 50%; }
.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27c93f; }

.terminal-title {
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
    font-size: 12px;
    font-weight: 500;
    color: #a1a1aa;
    flex: 1;
    text-align: center;
}

.terminal-actions {
    display: flex;
    gap: 8px;
}

.terminal-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.terminal-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* Status Bar */
.terminal-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #1a1a1f;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
    font-size: 11px;
    flex-shrink: 0;
}

.terminal-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #a1a1aa;
}

.terminal-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
}

.terminal-status-indicator.running {
    background: #10b981;
    animation: wpcd-pulse 1.5s infinite;
}

.terminal-status-indicator.success {
    background: #4ade80;
}

.terminal-status-indicator.error {
    background: #f87171;
}

.terminal-timer {
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

@keyframes wpcd-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
    50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

/* Terminal Progress */
.terminal-progress {
    height: 3px;
    background: rgba(255,255,255,0.05);
    overflow: hidden;
    flex-shrink: 0;
}

.terminal-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #a855f7, #3b82f6);
    width: 0%;
    transition: width 0.3s ease;
}

.terminal-progress-bar.indeterminate {
    width: 30%;
    animation: wpcd-progress-indeterminate 1.5s infinite;
}

@keyframes wpcd-progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* Terminal Body */
.terminal-body,
.terminal-content {
    padding: 16px;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.7;
    color: #d4d4d8;
    flex: 1;
}

.terminal-body::-webkit-scrollbar,
.terminal-content::-webkit-scrollbar {
    width: 8px;
}

.terminal-body::-webkit-scrollbar-track,
.terminal-content::-webkit-scrollbar-track {
    background: transparent;
}

.terminal-body::-webkit-scrollbar-thumb,
.terminal-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.terminal-body::-webkit-scrollbar-thumb:hover,
.terminal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* Terminal Lines - matching mockup colors */
.terminal-line {
    margin-bottom: 4px;
    white-space: pre-wrap;
    word-break: break-all;
}

.terminal-line.info,
.terminal-info { color: #a1a1aa; }

.terminal-line.ok,
.terminal-line.success,
.terminal-ok,
.terminal-success { color: #4ade80; }

.terminal-line.error,
.terminal-error { color: #f87171; }

.terminal-line.warn,
.terminal-line.warning,
.terminal-warn,
.terminal-warning { color: #fbbf24; }

.terminal-line.cmd,
.terminal-line.command,
.terminal-cmd,
.terminal-command { color: #818cf8; }

.terminal-line.prompt,
.terminal-prompt { color: #a855f7; }

/* Terminal Footer */
.terminal-footer {
    display: none;
    justify-content: flex-end;
    align-items: center;
    padding: 12px 16px;
    background: #16161a;
    border-top: 1px solid rgba(255,255,255,0.1);
    gap: 12px;
    flex-shrink: 0;
}

.terminal-footer.show,
.terminal-console .terminal-footer,
.modal .terminal-footer,
.terminal-overlay .terminal-footer {
    display: flex;
}

/* Terminal footer button styling for dark background */
.terminal-footer .btn,
.terminal-actions .btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.terminal-footer .btn-secondary,
.terminal-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.terminal-footer .btn-secondary:hover,
.terminal-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.terminal-footer .btn-primary,
.terminal-actions .btn-primary {
    background: var(--wpcd-brand-gradient, linear-gradient(135deg, #3b82f6, #8b5cf6));
    border: none;
    color: #fff;
}

.terminal-footer .btn-primary:hover,
.terminal-actions .btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.terminal-footer .btn-danger,
.terminal-actions .btn-danger {
    background: #ef4444;
    border: none;
    color: #fff;
}

.terminal-footer .btn-danger:hover,
.terminal-actions .btn-danger:hover {
    background: #dc2626;
}

/* ========== EMBEDDED TERMINAL (SAAS-style inline) ========== */
/* Matches the wpcd-saas-terminal style for in-page display */
.terminal-embedded,
.wpcd-terminal-embedded {
    position: relative;
    background: #0f0f12;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 20px 0;
}

.terminal-embedded .terminal-header,
.wpcd-terminal-embedded .terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #16161a;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    cursor: default;
}

.terminal-embedded .terminal-title,
.wpcd-terminal-embedded .terminal-title {
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
    font-size: 13px;
    font-weight: 600;
    color: #e4e4e7;
    flex: 1;
    text-align: left;
}

.terminal-embedded .terminal-status,
.wpcd-terminal-embedded .terminal-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    color: #4ade80;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.terminal-embedded .terminal-status::before,
.wpcd-terminal-embedded .terminal-status::before {
    content: "";
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: wpcd-pulse 2s infinite;
}

.terminal-embedded .terminal-status.error::before,
.wpcd-terminal-embedded .terminal-status.error::before {
    background: #f87171;
    animation: none;
}

.terminal-embedded .terminal-status.success::before,
.wpcd-terminal-embedded .terminal-status.success::before {
    background: #4ade80;
    animation: none;
}

.terminal-embedded .terminal-status.idle::before,
.wpcd-terminal-embedded .terminal-status.idle::before {
    background: #6b7280;
    animation: none;
}

.terminal-embedded .terminal-body,
.terminal-embedded .terminal-content,
.wpcd-terminal-embedded .terminal-body,
.wpcd-terminal-embedded .terminal-content {
    padding: 16px;
    min-height: 150px;
    max-height: 350px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.7;
    color: #d4d4d8;
}

/* Terminal line styles for embedded */
.terminal-embedded .terminal-line,
.wpcd-terminal-embedded .terminal-line {
    margin-bottom: 4px;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 2px 0;
}

.terminal-embedded .terminal-line.normal,
.wpcd-terminal-embedded .terminal-line.normal {
    color: #a1a1aa;
}

.terminal-embedded .terminal-line.info,
.wpcd-terminal-embedded .terminal-line.info {
    color: #60a5fa;
}

.terminal-embedded .terminal-line.success,
.wpcd-terminal-embedded .terminal-line.success {
    color: #4ade80;
}

.terminal-embedded .terminal-line.error,
.wpcd-terminal-embedded .terminal-line.error {
    color: #f87171;
}

.terminal-embedded .terminal-line.warning,
.wpcd-terminal-embedded .terminal-line.warning {
    color: #fbbf24;
}

.terminal-embedded .terminal-line.command,
.wpcd-terminal-embedded .terminal-line.command {
    color: #818cf8;
}

/* Timestamp prefix for log lines */
.terminal-embedded .terminal-line .terminal-timestamp,
.wpcd-terminal-embedded .terminal-line .terminal-timestamp {
    color: #6b7280;
    margin-right: 12px;
    font-size: 11px;
}

/* Embedded terminal footer with actions */
.terminal-embedded .terminal-footer,
.wpcd-terminal-embedded .terminal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 12px 16px;
    background: #16161a;
    border-top: 1px solid rgba(255,255,255,0.1);
    gap: 12px;
}

/* Hide footer by default, show when has content */
.terminal-embedded .terminal-footer:empty,
.wpcd-terminal-embedded .terminal-footer:empty {
    display: none;
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-dim);
}

.form-label .required {
    color: var(--danger);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    color: var(--text);
    transition: all var(--transition-normal);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input::placeholder {
    color: var(--text-faint);
}

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2371717a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

.form-hint {
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 6px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 6px;
}

.form-input.error {
    border-color: var(--danger);
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ========== NOTICE/ALERT ========== */
.notice {
    padding: 16px 20px;
    border-radius: 10px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.notice-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.notice-warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
}

.notice-warning .notice-icon { color: var(--warning); }

.notice-error,
.notice-danger {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
}

.notice-error .notice-icon,
.notice-danger .notice-icon { color: var(--danger); }

.notice-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
}

.notice-success .notice-icon { color: var(--success); }

.notice-info {
    background: var(--accent-bg);
    border: 1px solid var(--accent-border);
}

.notice-info .notice-icon { color: var(--accent); }

.notice-content h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.notice-content p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* ========== LOADING/SPINNER ========== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: wpcd-spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    border-radius: inherit;
    z-index: 100;
}

.loading-overlay .loading-text {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

/* ========== PROGRESS BAR ========== */
.progress {
    height: 8px;
    background: var(--bg-active);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--wpcd-brand-gradient);
    border-radius: var(--radius-sm);
    transition: width var(--transition-slow);
}

/* ========== STATUS BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-info {
    background: var(--accent-bg);
    color: var(--accent);
}

/* ========== GLOBAL TAB/PAGE TRANSITIONS ========== */
/*
 * Universal transition classes for tab panels and content areas.
 * Applied by WPCDUI.transition.apply() for consistent animations.
 */

.wpcd-tab-transitioning,
[class*="-tab-panel"].wpcd-tab-transitioning,
[class*="-panel"].wpcd-tab-transitioning,
[role="tabpanel"].wpcd-tab-transitioning,
.wpcd-content-area.wpcd-tab-transitioning,
.wpcd-main-content.wpcd-tab-transitioning {
    animation: wpcd-tab-fade-in 0.2s ease forwards;
}

@keyframes wpcd-tab-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state (during AJAX) */
.is-loading,
[class*="-tab-panel"].is-loading,
[class*="-panel"].is-loading,
[role="tabpanel"].is-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Tab loading spinner */
.wpcd-tab-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.wpcd-tab-loading-spinner {
    font-size: 32px;
    margin-bottom: 16px;
    color: var(--accent);
}

.wpcd-tab-loading-spinner i {
    animation: fa-spin 1s linear infinite;
}

.wpcd-tab-loading p {
    margin: 0;
    font-size: 14px;
}

/* Tab error state */
.wpcd-tab-error {
    padding: 40px 20px;
    text-align: center;
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: 8px;
    margin: 20px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .toast-container {
        left: 20px;
        right: 20px;
        bottom: 20px;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }

    .modal {
        margin: 20px;
        max-width: calc(100vw - 40px);
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}


#wpcd-nginx-config-textarea, #wpcd-phpini-config-textarea {
  min-height: 30vh;
}


.wpcd-app-tabs-content {
  min-height: 300px;
}


.wpcd-sites-table {
  margin-top: 20px;
}
/* ========== JOB DRAWER (docked terminal) ==========
   Bottom-of-viewport panel for long-running jobs. Never covers the page;
   minimises to a one-line bar. Shares .terminal-content/.terminal-line
   styles with the modal console above. */
/* All drawers live in one fixed stack; several jobs can be followed at once. */
.wpcd-job-drawers {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99990;
    display: flex;
    flex-direction: column;
}
.wpcd-job-drawer {
    position: relative;
    background: #0f1115;
    color: #d4d4d8;
    border-top: 1px solid #262a33;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    max-height: 46vh;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
/* Clear the wp-admin side menu; the frontend has no menu so the stack spans the viewport. */
body.wp-admin .wpcd-job-drawers { left: 160px; }
body.wp-admin.folded .wpcd-job-drawers { left: 36px; }
@media (max-width: 960px) { body.wp-admin.auto-fold .wpcd-job-drawers { left: 36px; } }
@media (max-width: 782px) { body.wp-admin .wpcd-job-drawers, body.wp-admin.auto-fold .wpcd-job-drawers { left: 0; } }
.wpcd-job-drawer.active { transform: translateY(0); }
.wpcd-job-drawer .wpcd-job-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    border-bottom: 1px solid #1f2430;
    font-size: 13px;
    flex-shrink: 0;
}
.wpcd-job-drawer .wpcd-job-title { font-weight: 600; color: #fff; white-space: nowrap; }
.wpcd-job-drawer .wpcd-job-stage { color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.wpcd-job-drawer .wpcd-job-elapsed { color: #6b7280; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wpcd-job-drawer .wpcd-job-state {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 999px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.wpcd-job-drawer .wpcd-job-state.running { background: #1e2a3d; color: #7cb3ff; }
.wpcd-job-drawer .wpcd-job-state.success { background: #12301f; color: #4ade80; }
.wpcd-job-drawer .wpcd-job-state.error   { background: #3a1616; color: #f87171; }
.wpcd-job-drawer .wpcd-job-progress {
    flex: 1;
    height: 6px;
    background: #1f2430;
    border-radius: 3px;
    overflow: hidden;
    min-width: 80px;
}
.wpcd-job-drawer .wpcd-job-progress i { display: block; height: 100%; width: 0; background: #6366f1; transition: width 0.4s; }
.wpcd-job-drawer .wpcd-job-state.success ~ .wpcd-job-progress i,
.wpcd-job-drawer .wpcd-job-head:has(.wpcd-job-state.success) .wpcd-job-progress i { background: #22c55e; }
.wpcd-job-drawer .wpcd-job-head:has(.wpcd-job-state.error) .wpcd-job-progress i { background: #ef4444; }
.wpcd-job-drawer .terminal-actions { display: flex; gap: 6px; margin-left: auto; }
.wpcd-job-btn {
    background: transparent;
    border: 1px solid #2b3240;
    color: #d4d4d8;
    border-radius: 6px;
    padding: 4px 10px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}
.wpcd-job-btn:hover { background: #1a1f2a; color: #fff; }
.wpcd-job-btn.primary { background: #6366f1; border-color: #6366f1; color: #fff; }
.wpcd-job-btn i { margin-right: 4px; font-size: 11px; }
.wpcd-job-drawer .wpcd-job-log {
    min-height: 120px;
    max-height: none;
    flex: 1;
    overflow-y: auto;
}
/* Minimised: header + log hidden, one-line bar shown. */
.wpcd-job-drawer .wpcd-job-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    font-size: 12.5px;
    cursor: pointer;
    flex-shrink: 0;
}
.wpcd-job-drawer .wpcd-job-bar-dot { width: 8px; height: 8px; border-radius: 50%; background: #7cb3ff; box-shadow: 0 0 0 3px rgba(124, 179, 255, 0.18); }
.wpcd-job-drawer .wpcd-job-bar-dot[data-state="success"] { background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18); }
.wpcd-job-drawer .wpcd-job-bar-dot[data-state="error"] { background: #f87171; box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.18); }
.wpcd-job-drawer .wpcd-job-bar-label { color: #fff; font-weight: 500; white-space: nowrap; }
.wpcd-job-drawer .wpcd-job-bar-hint { color: #6b7280; margin-left: auto; white-space: nowrap; }
.wpcd-job-drawer.minimized .wpcd-job-head,
.wpcd-job-drawer.minimized .wpcd-job-log { display: none; }
.wpcd-job-drawer.minimized .wpcd-job-bar { display: flex; }
/* Keep page content reachable above the drawer. */
/* The page reserves exactly the drawer's rendered height (set as --wpcd-drawer-h by
   wpcd-ui.js from a ResizeObserver), so a three-line job does not push the footer
   up by half a screen; the drawer itself is capped at 46vh. */
body.wpcd-job-drawer-open { padding-bottom: var(--wpcd-drawer-h, 44px); }
/* Toasts sit above the drawer instead of on top of its output (same rule wins
   on wp-admin and the frontend: both ship a bottom-anchored .toast-container). */
body.wpcd-job-drawer-open .toast-container { bottom: calc(var(--wpcd-drawer-h, 44px) + 20px); }

/* ========== IN-PLACE PATCHING FEEDBACK ========== */
.wpcd-refreshing { position: relative; }
.wpcd-refreshing::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #6366f1, transparent);
    background-size: 200% 100%;
    animation: wpcd-refresh-sweep 1s linear infinite;
    pointer-events: none;
}
@keyframes wpcd-refresh-sweep { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.wpcd-card-changed { box-shadow: 0 0 0 2px #6366f1 inset !important; transition: box-shadow 0.3s; }

/* Freshness line: "as of 12 s ago · updates automatically" */
.wpcd-fresh {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--wpcd-text-muted, #6b7280);
    margin: 0 0 10px;
}
.wpcd-tab-recent .wpcd-fresh { margin: 0 0 0 auto; font-size: 12px; }
.wpcd-tab-recent.is-fresh-only .wpcd-fresh { margin-left: 0; }
.wpcd-fresh .wpcd-fresh-ago { font-weight: 600; color: var(--text, #111827); }
.wpcd-fresh .wpcd-fresh-read { display: inline-flex; align-items: center; gap: 6px; color: var(--wpcd-primary, #6366f1) !important; text-decoration: none !important; padding: 6px 12px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--wpcd-primary, #6366f1); border-radius: 6px; background: var(--bg-card, #fff); line-height: 1.2; }
.wpcd-fresh .wpcd-fresh-read::before { content: '\21bb'; font-size: 13px; }
.wpcd-fresh .wpcd-fresh-read:hover { background: var(--accent-bg, rgba(99,102,241,0.08)); }
.wpcd-tab-recent.is-fresh-only { padding: 6px 8px; }
.wpcd-fresh .wpcd-fresh-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; display: inline-block; }
.wpcd-fresh.stale .wpcd-fresh-dot { background: #f59e0b; }
.wpcd-fresh .wpcd-fresh-now { color: inherit; text-decoration: underline dotted; cursor: pointer; }
.wpcd-fresh .wpcd-fresh-read { cursor: pointer; }
.wpcd-fresh .wpcd-fresh-now:hover { color: var(--wpcd-primary, #6366f1); }
.wpcd-fresh .wpcd-fresh-read.loading { opacity: 0.6; pointer-events: none; }
.wpcd-fresh.checking .wpcd-fresh-dot { animation: wpcd-fresh-spin 0.8s linear infinite; border-radius: 2px; background: #6366f1; }
@keyframes wpcd-fresh-spin { to { transform: rotate(360deg); } }
.wpcd-fresh.checking .wpcd-fresh-now { opacity: 0.7; }

/* Recent jobs strip at the top of a tab: what ran here and how it ended. */
.wpcd-tab-recent {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    font-size: 12px;
    color: var(--wpcd-text-muted, #6b7280);
    margin: 0 0 12px;
    padding: 6px 10px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    background: var(--bg-hover, #f8fafc);
}
.wpcd-tab-recent-title { font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }
.wpcd-tab-recent-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.wpcd-tab-recent-item b { font-weight: 600; color: var(--text, #111827); }
.wpcd-tab-recent-dot { width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; flex: none; }
.wpcd-tab-recent-item.ok .wpcd-tab-recent-dot { background: #22c55e; }
.wpcd-tab-recent-item.bad .wpcd-tab-recent-dot { background: #ef4444; }
.wpcd-tab-recent-item.bad { color: #b91c1c; }
.wpcd-tab-recent-item.unknown .wpcd-tab-recent-dot { background: #f59e0b; }
.wpcd-tab-recent-item.running .wpcd-tab-recent-dot { background: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); animation: wpcd-recent-pulse 1.4s ease-in-out infinite; }
@keyframes wpcd-recent-pulse { 50% { box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.08); } }
.wpcd-tab-recent-who { opacity: 0.75; }
.wpcd-tab-recent-msg { white-space: normal; opacity: 0.85; }
.wpcd-tab-recent-attach { color: var(--wpcd-primary, #6366f1); text-decoration: underline dotted; }
