/* Project config drawer, env, OAuth, domains */
/* Project config drawer, env, OAuth, domains (moved from main.css) */

/* --- Config Drawer --- */

.modal-overlay.drawer {
    justify-content: flex-end;
    align-items: stretch;
    backdrop-filter: blur(3px);
}

.config-drawer {
    width: 560px;
    max-width: 92vw;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    animation: drawer-slide-in 0.22s ease-out;
}

@keyframes drawer-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.config-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.config-drawer-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.config-drawer-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 2px;
    font-family: var(--font-mono, ui-monospace, monospace);
}

.config-drawer-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

.config-drawer-nav {
    width: 160px;
    padding: 16px 10px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.config-drawer-content {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
}

.config-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.config-row label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.config-value {
    font-size: 14px;
    color: var(--text-primary);
    font-family: var(--font-mono, ui-monospace, monospace);
}

.config-repository-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.config-repository-error {
    margin: 4px 0 0;
    color: var(--danger);
    font-size: 13px;
}

.config-placeholder {
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
}

/* --- Toggle Switch --- */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.toggle-switch:hover {
    border-color: var(--text-muted);
}
.toggle-switch.on {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
}
.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.toggle-switch.on .toggle-thumb {
    transform: translateX(20px);
    background: #60a5fa;
}
.toggle-label {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.mode-choice-row {
    display: inline-flex;
    width: fit-content;
    padding: 3px;
    gap: 3px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.mode-choice {
    min-width: 104px;
    height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition-speed), color var(--transition-speed);
}

.mode-choice:hover:not(:disabled) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.mode-choice.active {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.18);
}

.mode-choice:disabled {
    cursor: not-allowed;
}

/* --- Environment Variables --- */
.env-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 12px 0 10px;
    font-size: 14px;
    color: var(--text-muted);
}
.env-meta-dirty {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}
.env-meta-pending {
    color: var(--warning, #f59e0b);
}
.env-meta-reset {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}
.env-meta-reset:hover { color: var(--text-primary); }

.env-empty {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
}

.env-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.env-grid-row {
    display: grid;
    grid-template-columns: minmax(120px, 30%) 1fr auto auto;
    gap: 8px;
    align-items: center;
}
.env-input {
    padding: 7px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-mono, ui-monospace, monospace);
    min-width: 0;
}
.env-input:focus {
    outline: none;
    border-color: var(--accent);
}
.env-input[readonly] {
    color: var(--text-secondary);
    cursor: default;
}
.env-row-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
}
.env-row-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.env-row-icon:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}
.env-row-icon:disabled:hover {
    background: none;
    color: var(--text-muted);
}
.env-row-icon.env-row-remove:hover { color: var(--danger, #ef4444); }

.env-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.env-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.env-toast {
    margin-top: 10px;
    margin-left: auto;
    width: max-content;
    max-width: 100%;
    padding: 7px 10px;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.22);
    font-size: 14px;
    color: var(--success, #22c55e);
    animation: env-fade 2s ease-out forwards;
}
@keyframes env-fade {
    0%, 40% { opacity: 1; }
    100% { opacity: 0; }
}

/* --- Bring-your-own Google OAuth --- */
.oauth-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0;
    color: var(--text-muted);
    font-size: 14px;
}
.oauth-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}
.oauth-status.ready {
    color: var(--success, #22c55e);
}
.oauth-status.ready .oauth-status-dot {
    background: var(--success, #22c55e);
}
.oauth-setup-note {
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}
.oauth-setup-note ol {
    margin: 8px 0 0 20px;
    padding: 0;
}
.oauth-setup-note li + li {
    margin-top: 6px;
}
.oauth-setup-note code {
    display: inline;
    overflow-wrap: anywhere;
    color: var(--text-primary);
}
.oauth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 14px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}
.oauth-field small {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 400;
}
.oauth-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.oauth-remove {
    margin-right: auto;
    color: var(--danger, #ef4444);
}

/* --- Custom Domains --- */
.domain-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.domain-section-head .form-help-text {
    margin-bottom: 0;
}
.domain-automation-note {
    max-width: 440px;
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.45;
}
.domain-connect-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.domain-cf-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.domain-cf-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.domain-cf-status.connected {
    color: #22c55e;
}
.domain-cf-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 16%, transparent);
}
.domain-add-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
}
.domain-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.domain-add-input {
    flex: 1;
    min-width: 220px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-mono, ui-monospace, monospace);
}
.domain-add-input:focus {
    outline: none;
    border-color: var(--accent);
}
.domain-email-option {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
}
.domain-email-option input {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
}
.domain-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.domain-row {
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.domain-row-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chat-command-suggestions {
    position: absolute;
    z-index: 4;
    left: 52px;
    bottom: calc(100% - 6px);
    min-width: 272px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-secondary);
    box-shadow: 0 10px 24px rgb(0 0 0 / 18%);
}

.chat-command-suggestion {
    display: flex;
    width: 100%;
    align-items: baseline;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.chat-command-suggestion:hover,
.chat-command-suggestion:focus-visible {
    background: var(--bg-hover);
}

.chat-command-suggestion code {
    color: var(--accent);
    font-weight: 650;
}

.chat-command-suggestion span {
    color: var(--text-secondary);
    font-size: 12px;
}
.domain-host {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 14px;
    color: var(--text-primary);
}
.domain-row-head .domain-state,
.domain-row-head .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}
.domain-state {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.domain-state.pending {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}
.domain-state.ready {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}
.domain-state.failed {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.domain-email-status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--text-muted);
}
.domain-email-status code {
    padding: 3px 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono, ui-monospace, monospace);
    color: var(--text-primary);
}
.domain-hint {
    font-size: 14px;
    color: var(--text-muted);
}
.domain-hint-label {
    font-weight: 500;
    margin-bottom: 2px;
}
.domain-hint code {
    display: block;
    padding: 6px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-all;
}
.domain-link {
    font-size: 14px;
    color: var(--accent);
    text-decoration: none;
    word-break: break-all;
}
.domain-link:hover { text-decoration: underline; }
.domain-error {
    font-size: 14px;
    color: #ef4444;
}
.form-error {
    margin-top: 4px;
    font-size: 14px;
    color: #ef4444;
}
.form-success {
    margin-top: 4px;
    font-size: 14px;
    color: var(--success, #22c55e);
}

.admin-referral-updated {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-muted);
}


