/* ============================================
   Plugin admin styles
   ============================================ */
:root {
    --al-brand:        #0f766e;
    --al-brand-light:  #f0fdfa;
    --al-brand-dark:   #115e59;

    /* Ink palette */
    --al-ink-50:       #f8fafc;
    --al-ink-100:      #f1f5f9;
    --al-ink-200:      #e2e8f0;
    --al-ink-300:      #cbd5e1;
    --al-ink-400:      #94a3b8;
    --al-ink-500:      #64748b;
    --al-ink-600:      #475569;
    --al-ink-700:      #334155;
    --al-ink-800:      #1e293b;
    --al-ink-900:      #0f172a;

    /* Aliases used by existing markup (kept for compatibility) */
    --al-text-primary:   var(--al-ink-900);
    --al-text-secondary: var(--al-ink-500);
    --al-text-muted:     var(--al-ink-400);
    --al-border:         var(--al-ink-200);
    --al-bg:             var(--al-ink-50);
    --al-white:          #ffffff;

    /* Primary action color — ink-900 per brand decision. Hover lightens to ink-600. */
    --al-accent:       var(--al-ink-900);
    --al-accent-hover: var(--al-ink-600);

    /* Semantic states — values and soft backgrounds per design system */
    --al-success:    #047857;
    --al-success-bg: #ecfdf5;
    --al-error:      #b91c1c;
    --al-error-bg:   #fef2f2;
    --al-warning:    #b45309;
    --al-warning-bg: #fffbeb;
}

/* Reset */
.al-wrap {
    margin: 0;
    padding: 32px 24px;
    max-width: 960px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.al-wrap * {
    box-sizing: border-box;
}

/* Page Header */
.al-header {
    margin-bottom: 32px;
}

.al-logo {
    display: block;
    height: auto;
    width: 120px;
    margin-bottom: 16px;
}

.al-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--al-text-primary);
    margin: 0 0 4px 0;
    padding: 0;
    line-height: 1.3;
}

.al-header p {
    font-size: 14px;
    color: var(--al-text-secondary);
    margin: 0;
}

/* Tabs */
.al-tabs {
    display: flex;
    gap: 0;
    background: var(--al-white);
    border: 1px solid var(--al-border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 24px;
    width: fit-content;
}

.al-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--al-text-secondary);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.al-tab:hover {
    color: var(--al-text-primary);
    background: var(--al-bg);
}

.al-tab.active {
    color: var(--al-ink-900);
    background: var(--al-ink-100);
    font-weight: 600;
}

.al-tab.active svg {
    color: var(--al-brand);
}

.al-tab svg {
    width: 16px;
    height: 16px;
}

/* Card */
.al-card {
    background: var(--al-white);
    border: 1px solid var(--al-border);
    border-radius: 12px;
    margin-bottom: 24px;
}

.al-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--al-border);
}

.al-card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--al-text-primary);
    margin: 0 0 4px 0;
}

.al-card-header p {
    font-size: 13px;
    color: var(--al-text-secondary);
    margin: 0;
}

.al-card-body {
    padding: 24px;
}

/* Status Banner */
.al-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--al-bg);
    border-radius: 8px;
    margin-bottom: 24px;
}

.al-status-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.al-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--al-text-muted);
}

.al-status-dot.connected { background: var(--al-success); }
.al-status-dot.error { background: var(--al-error); }
.al-status-dot.pending { background: var(--al-warning); }

.al-status-text {
    font-size: 14px;
    color: var(--al-text-secondary);
}

.al-status-text strong {
    color: var(--al-text-primary);
}

/* Form */
.al-form-group {
    margin-bottom: 20px;
}

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

.al-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--al-text-primary);
    margin-bottom: 8px;
}

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

.al-hint a {
    color: var(--al-ink-700);
    text-decoration: underline;
}

.al-hint a:hover {
    color: var(--al-ink-900);
}

.al-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--al-text-primary);
    background: var(--al-white);
    border: 1px solid var(--al-border);
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.al-input:focus {
    outline: none;
    border-color: var(--al-ink-900);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.12);
}

.al-input::placeholder {
    color: var(--al-text-muted);
}

.al-input-mono {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
    font-size: 13px;
}

/* Toggle Row */
.al-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--al-border);
}

.al-toggle-row:first-child {
    padding-top: 0;
}

.al-toggle-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.al-toggle-content {
    flex: 1;
    padding-right: 20px;
}

.al-toggle-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--al-text-primary);
    margin: 0 0 2px 0;
}

.al-toggle-desc {
    font-size: 13px;
    color: var(--al-text-secondary);
    margin: 0;
}

/* Toggle Switch */
.al-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.al-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.al-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: 0.2s;
}

.al-switch-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.al-switch input:checked + .al-switch-slider {
    background: var(--al-accent);
}

.al-switch input:checked + .al-switch-slider:before {
    transform: translateX(20px);
}

/* Buttons */
.al-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    text-decoration: none;
}

.al-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.al-btn-primary,
.al-btn-primary:visited {
    background: var(--al-accent);
    color: var(--al-white);
}

.al-btn-primary:hover:not(:disabled),
.al-btn-primary:focus:not(:disabled),
.al-btn-primary:active:not(:disabled) {
    background: var(--al-accent-hover);
    color: var(--al-white);
    text-decoration: none;
}

.al-btn-secondary,
.al-btn-secondary:visited {
    background: var(--al-white);
    color: var(--al-text-primary);
    border: 1px solid var(--al-border);
}

.al-btn-secondary:hover:not(:disabled),
.al-btn-secondary:focus:not(:disabled),
.al-btn-secondary:active:not(:disabled) {
    background: var(--al-bg);
    color: var(--al-text-primary);
    text-decoration: none;
}

.al-btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

/* Alert */
.al-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
}

.al-alert-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.al-alert-success {
    background: var(--al-success-bg);
    color: #065f46;
}

.al-alert-warning {
    background: var(--al-warning-bg);
    color: #92400e;
}

.al-alert-error {
    background: var(--al-error-bg);
    color: #991b1b;
}

/* Actions Footer */
.al-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Toast Notification */
.al-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    background: var(--al-accent);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 99999;
}

.al-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.al-toast.success { background: var(--al-success); }
.al-toast.error { background: var(--al-error); }

/* Disabled Section */
.al-disabled-section {
    opacity: 0.5;
    pointer-events: none;
}

/* Tab Content */
.al-tab-content {
    display: none;
}

.al-tab-content.active {
    display: block;
}

/* Responsive */
@media (max-width: 600px) {
    .al-wrap {
        padding: 20px 16px;
    }
    
    .al-tabs {
        width: 100%;
    }
    
    .al-tab {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
    }
    
    .al-toggle-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .al-toggle-content {
        padding-right: 0;
    }
}
