/* =========================================================
   Katalogus Deploy — UI
   ========================================================= */

:root {
    --purple:       #7f54b3;
    --purple-dark:  #5b3d87;
    --purple-light: #f0ebf8;
    --text:         #1e1e2e;
    --text-muted:   #6b6b80;
    --border:       #dcdcde;
    --bg:           #f4f4f6;
    --white:        #fff;
    --green:        #3d8b5e;
    --green-bg:     #edf7f1;
    --red:          #c0392b;
    --red-bg:       #fdf0ee;
    --radius:       8px;
    --shadow:       0 2px 12px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Login ──────────────────────────────────────────────── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.logo-k {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--purple);
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    border-radius: 8px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.login-sub {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 24px;
}

/* ── Header ─────────────────────────────────────────────── */
.kd-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.kd-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kd-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kd-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.domain-badge {
    background: var(--purple-light);
    color: var(--purple-dark);
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

/* ── Tabs ───────────────────────────────────────────────── */
.kd-tabs-wrap {
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.kd-tabs {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 0;
}

.kd-tab {
    padding: 12px 22px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    transition: color .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kd-tab:hover { color: var(--purple); }
.kd-tab.active { color: var(--purple); border-bottom-color: var(--purple); }

.badge {
    background: var(--purple);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    padding: 1px 7px;
    line-height: 18px;
}

/* ── Main / layout ──────────────────────────────────────── */
.kd-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
}

.kd-tab-content { display: none; }
.kd-tab-content.active { display: block; }

.kd-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 32px;
    margin-bottom: 20px;
}

.kd-card h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text);
}

/* ── Form ───────────────────────────────────────────────── */
.form-row {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

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

.field-full { grid-column: 1 / -1; }

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 13px;
    color: var(--text);
}

.required { color: var(--red); margin-left: 2px; }

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
    background: var(--white);
    color: var(--text);
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(127,84,179,.18);
}

.field-hint {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
}

/* Subdomain input */
.subdomain-input-wrap {
    display: flex;
    align-items: stretch;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}

.subdomain-input-wrap:focus-within {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(127,84,179,.18);
}

.subdomain-input-wrap input {
    border: none;
    border-radius: 0;
    flex: 1;
    box-shadow: none !important;
    padding-right: 4px;
}

.subdomain-suffix {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
    border-left: 1.5px solid var(--border);
}

.section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin: 20px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.form-actions {
    margin-top: 28px;
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--purple);
    color: #fff;
    border-color: var(--purple);
}
.btn-primary:hover { background: var(--purple-dark); border-color: var(--purple-dark); text-decoration: none; color: #fff; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-outline {
    background: transparent;
    color: var(--purple);
    border-color: var(--purple);
}
.btn-outline:hover { background: var(--purple-light); text-decoration: none; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
    padding: 6px 12px;
    font-size: 13px;
}
.btn-ghost:hover { color: var(--text); background: var(--bg); text-decoration: none; }

.btn-sm  { padding: 5px 14px; font-size: 13px; }
.btn-lg  { padding: 12px 32px; font-size: 15px; }
.btn-full { width: 100%; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid #f5c6c3; }

/* ── Loading / resultado ────────────────────────────────── */
.resultado-card { margin-top: 0; }

.spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 16px;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--purple-light);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

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

.loading-msg {
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
}

.log-list {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: 6px;
    padding: 16px 18px;
    max-height: 320px;
    overflow-y: auto;
    margin: 16px 0;
    line-height: 1.8;
}

.log-list .log-ok   { color: #a6e3a1; }
.log-list .log-err  { color: #f38ba8; }
.log-list .log-info { color: #89dceb; }

/* Sucesso */
.sucesso-box {
    background: var(--green-bg);
    border: 1px solid #c3e6d6;
    border-radius: 8px;
    padding: 20px 24px;
}

.sucesso-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #d4eddf;
}
.sucesso-row:last-of-type { border-bottom: none; }

.sucesso-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--green);
    min-width: 160px;
}

.sucesso-link {
    font-weight: 600;
    color: var(--purple);
    font-size: 14px;
}

.sucesso-val {
    font-size: 14px;
    color: var(--text);
}

.mono { font-family: 'Consolas', monospace; font-size: 13px; }

.sucesso-nota {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
    margin-bottom: 16px;
}

/* Erro */
.erro-box {
    background: var(--red-bg);
    border: 1px solid #f5c6c3;
    border-radius: 8px;
    padding: 20px 24px;
}
.erro-box p { color: var(--red); font-weight: 600; margin-bottom: 16px; }

/* ── Histórico ──────────────────────────────────────────── */
.empty-state {
    color: var(--text-muted);
    font-size: 15px;
    text-align: center;
    padding: 40px 20px;
}

.table-wrap { overflow-x: auto; }

.kd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.kd-table th {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.kd-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.kd-table tr:last-child td { border-bottom: none; }
.kd-table tr:hover td { background: var(--purple-light); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 720px) {
    .form-row-2 { grid-template-columns: 1fr; }
    .kd-card { padding: 20px 16px; }
    .kd-main { padding: 16px; }
}
