/* Comingweb Deploy Panel — stile SaaS sobrio e responsive */

:root {
    --bg:        #0f1115;
    --surface:   #171a21;
    --surface-2: #1e222b;
    --border:    #2a2f3a;
    --text:      #e6e9ef;
    --muted:     #8b93a4;
    --primary:   #3b82f6;
    --primary-d: #2563eb;
    --success:   #22c55e;
    --error:     #ef4444;
    --running:   #f59e0b;
    --radius:    10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .4rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.muted { color: var(--muted); }
.text-error { color: var(--error); }
.pad { padding: 1rem; }

/* ---------- Layout con sidebar ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.2rem 0;
    flex-shrink: 0;
}
.brand {
    padding: 0 1.3rem 1.2rem;
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.2;
    border-bottom: 1px solid var(--border);
}
.brand small { color: var(--muted); font-weight: 500; }
.brand-dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%;
    background: var(--primary); margin-right: 8px;
}
.sidebar nav { display: flex; flex-direction: column; padding: 1rem 0; flex: 1; }
.sidebar nav a {
    color: var(--muted);
    padding: .6rem 1.3rem;
    font-weight: 500;
}
.sidebar nav a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.sidebar nav a.active { color: var(--text); border-left: 3px solid var(--primary); background: var(--surface-2); }
.sidebar-foot { padding: 1rem 1.3rem 0; border-top: 1px solid var(--border); }
.sidebar-foot .user { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.sidebar-foot .logout { color: var(--error); font-size: .9rem; }

.content { flex: 1; min-width: 0; }
.topbar {
    padding: 1.2rem 2rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.page { padding: 2rem; max-width: 1100px; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.2rem;
}
.card-label { color: var(--muted); font-size: .85rem; margin-bottom: .5rem; }
.card-value { font-size: 2rem; font-weight: 700; }
.card-value-sm { font-size: 1rem; font-weight: 600; }
.card-cta { display: flex; align-items: center; justify-content: center; }

/* ---------- Panels & tables ---------- */
.panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem;
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.3rem; border-bottom: 1px solid var(--border);
}
.panel-head h2 { margin: 0; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .75rem 1.3rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: .2rem .6rem; border-radius: 20px;
    font-size: .78rem; font-weight: 600;
}
.badge-success { background: rgba(34,197,94,.15);  color: var(--success); }
.badge-error   { background: rgba(239,68,68,.15);  color: var(--error); }
.badge-running { background: rgba(245,158,11,.15); color: var(--running); }
.badge-idle    { background: rgba(139,147,164,.15); color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block; padding: .55rem 1.1rem; border-radius: 8px;
    font-weight: 600; font-size: .92rem; border: 1px solid transparent;
    cursor: pointer; background: var(--surface-2); color: var(--text);
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-danger { background: var(--error); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; }

/* ---------- Forms ---------- */
label { display: block; margin-bottom: 1rem; font-size: .9rem; color: var(--muted); }
input, select, textarea {
    display: block; width: 100%; margin-top: .35rem;
    padding: .6rem .7rem; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; font-size: .95rem;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { min-height: 90px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ---------- Alerts ---------- */
.alert { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1.2rem; font-size: .92rem; }
.alert ul { margin: 0; padding-left: 1.2rem; }
.alert-error   { background: rgba(239,68,68,.12);  color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.alert-success { background: rgba(34,197,94,.12);  color: #86efac; border: 1px solid rgba(34,197,94,.3); }
.alert-info    { background: rgba(59,130,246,.12); color: #93c5fd; border: 1px solid rgba(59,130,246,.3); }

/* ---------- Code / output ---------- */
pre.output {
    background: #0b0d11; border: 1px solid var(--border); border-radius: 8px;
    padding: 1rem; overflow: auto; font-size: .82rem; line-height: 1.45;
    max-height: 500px; white-space: pre-wrap; word-break: break-word;
    font-family: "SF Mono", Menlo, Consolas, monospace; color: #cbd5e1;
}
code.inline {
    background: var(--surface-2); padding: .15rem .4rem; border-radius: 5px;
    font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .85rem;
}

/* ---------- Detail rows ---------- */
.detail-grid { display: grid; grid-template-columns: 180px 1fr; gap: .5rem 1rem; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; word-break: break-word; }

.row-actions { display: flex; gap: .5rem; }

/* ---------- Auth (login/install) ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem; }
.auth-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 380px;
}
.auth-card-wide { max-width: 560px; }
.auth-brand { font-weight: 700; margin-bottom: 1.5rem; }
.auth-card h2 { margin-top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 780px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .8rem; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; padding: 0; }
    .sidebar nav a { padding: .4rem .8rem; }
    .brand, .sidebar-foot { border: none; padding: .4rem .8rem; }
    .page { padding: 1.2rem; }
    .grid-2, .detail-grid { grid-template-columns: 1fr; }
}
