/* app.css — The Orange Cloud UI */

:root {
    --primary:        #f97316;
    --primary-dark:   #ea6c07;
    --primary-light:  #fff7ed;
    --topbar-bg:      #1e293b;
    --sidebar-bg:     #ffffff;
    --sidebar-width:  240px;
    --topbar-h:       56px;
    --body-bg:        #f1f5f9;
    --card-bg:        #ffffff;
    --border:         #e2e8f0;
    --text:           #1e293b;
    --text-muted:     #64748b;
    --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
}

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

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: var(--text);
    font-size: .9rem;
}

/* ── Topbar ───────────────────────────────────────────────────────────────── */
#topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--topbar-bg);
    display: flex; align-items: center;
    padding: 0 20px;
    z-index: 1000;
    gap: 12px;
}
#topbar .brand {
    display: flex; align-items: center; gap: 8px;
    color: #fff; font-weight: 700; font-size: 1rem;
    text-decoration: none; flex: 1;
}
#topbar .brand .dot {
    width: 26px; height: 26px; border-radius: 6px;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; font-weight: 800; color: #fff;
}
#topbar .user-chip {
    display: flex; align-items: center; gap: 8px;
    color: #94a3b8; font-size: .82rem;
    cursor: pointer;
}
#topbar .user-chip .avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700;
}
#topbar .btn-logout {
    background: transparent; border: 1px solid #334155;
    color: #94a3b8; padding: 5px 12px; border-radius: 6px;
    cursor: pointer; font-size: .8rem; transition: .15s;
}
#topbar .btn-logout:hover { border-color: #f97316; color: #f97316; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
#sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    overflow-y: auto; z-index: 900;
    padding: 12px 0;
}
.sidebar-section {
    padding: 8px 16px 4px;
    font-size: .7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted);
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 20px;
    color: var(--text-muted);
    text-decoration: none; cursor: pointer;
    border-left: 3px solid transparent;
    transition: .15s; font-size: .875rem;
}
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}
.nav-item i { font-size: 1rem; min-width: 18px; }

/* ── Main Content ─────────────────────────────────────────────────────────── */
#main {
    margin-top: var(--topbar-h);
    margin-left: var(--sidebar-width);
    padding: 28px 32px;
    min-height: calc(100vh - var(--topbar-h));
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 20px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.card-title {
    font-size: .95rem; font-weight: 600; margin: 0;
}

/* ── Page Header ──────────────────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.page-title { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--text-muted); font-size: .85rem; margin: 4px 0 0; }

/* ── Stat Cards ───────────────────────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
}
.stat-card .label { font-size: .78rem; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }
.stat-card .value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-card .icon {
    float: right; font-size: 1.6rem;
    opacity: .18; margin-top: -2px;
}
.stat-card.orange .value, .stat-card.orange .icon { color: var(--primary); }
.stat-card.green  .value, .stat-card.green  .icon { color: #16a34a; }
.stat-card.blue   .value, .stat-card.blue   .icon { color: #2563eb; }
.stat-card.amber  .value, .stat-card.amber  .icon { color: #d97706; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 16px; border-radius: 7px;
    font-size: .84rem; font-weight: 500; cursor: pointer;
    border: 1px solid transparent; transition: .15s;
    text-decoration: none;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline   { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger    { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fecaca; }
.btn-success   { background: #dcfce7; color: #16a34a; border-color: #bbf7d0; }
.btn-sm { padding: 4px 10px; font-size: .78rem; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* ── Status Badges ────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 999px;
    font-size: .72rem; font-weight: 600;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-running  { background: #dcfce7; color: #16a34a; }
.badge-building { background: #fef3c7; color: #d97706; }
.badge-pending  { background: #f1f5f9; color: #64748b; }
.badge-stopped  { background: #f1f5f9; color: #64748b; }
.badge-paused   { background: #dbeafe; color: #2563eb; }
.badge-error    { background: #fee2e2; color: #dc2626; }
.badge-static   { background: #e0f2fe; color: #0369a1; }
.badge-compose  { background: #ede9fe; color: #7c3aed; }
.badge-dockerfile { background: #fce7f3; color: #be185d; }
.badge-active     { background: #dcfce7; color: #16a34a; }
.badge-suspended  { background: #fee2e2; color: #dc2626; }
.badge-admin      { background: #fef3c7; color: #d97706; }
.badge-user       { background: #f1f5f9; color: #64748b; }

/* ── Project Cards ────────────────────────────────────────────────────────── */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
}
.project-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 18px 20px;
    transition: box-shadow .15s, border-color .15s;
    cursor: pointer;
}
.project-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    border-color: var(--primary);
}
.project-card .project-name {
    font-weight: 600; font-size: .95rem; margin-bottom: 8px;
}
.project-card .project-url {
    font-size: .78rem; color: var(--primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 10px;
}
.project-card .project-meta {
    display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap;
}
.project-card .project-actions {
    display: flex; gap: 6px; margin-top: 12px;
    padding-top: 12px; border-top: 1px solid var(--border);
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .855rem; }
thead th {
    padding: 10px 14px; text-align: left;
    background: #f8fafc; border-bottom: 1px solid var(--border);
    font-weight: 600; font-size: .78rem;
    text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafafa; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 500; margin-bottom: 5px; font-size: .85rem; }
.form-control {
    width: 100%; padding: 8px 12px;
    border: 1px solid var(--border); border-radius: 7px;
    font-size: .875rem; outline: none; transition: .15s;
    background: #fff; color: var(--text);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249,115,22,.12); }

/* ── Dropzone ─────────────────────────────────────────────────────────────── */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: .15s;
    background: #fafafa;
}
.dropzone.drag-over, .dropzone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.dropzone i { font-size: 2.2rem; color: var(--primary); margin-bottom: 8px; }
.dropzone p { margin: 0; color: var(--text-muted); font-size: .85rem; }
.dropzone .file-name {
    margin-top: 10px; font-weight: 600; color: var(--text);
    font-size: .85rem;
}

/* ── Progress ─────────────────────────────────────────────────────────────── */
.progress-wrap {
    background: #e2e8f0; border-radius: 999px;
    height: 6px; overflow: hidden;
}
.progress-bar {
    height: 100%; background: var(--primary);
    border-radius: 999px; transition: width .4s ease;
}
.progress-steps { margin-top: 8px; font-size: .8rem; color: var(--text-muted); }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
    padding: 10px 16px; border-radius: 8px;
    font-size: .85rem; margin-bottom: 16px;
    display: flex; align-items: flex-start; gap: 8px;
}
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: .3; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p  { font-size: .85rem; margin-bottom: 20px; }

/* ── URL Copy box ─────────────────────────────────────────────────────────── */
.url-box {
    display: flex; align-items: center; gap: 8px;
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 12px;
}
.url-box a { flex: 1; color: var(--primary); font-size: .85rem; word-break: break-all; }
.url-box button {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.url-box button:hover { color: var(--primary); background: var(--primary-light); }

/* ── Login Page ───────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}
.login-card {
    width: 100%; max-width: 400px;
    background: #fff; border-radius: 14px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo {
    display: flex; align-items: center; gap: 10px;
    justify-content: center; margin-bottom: 28px;
}
.login-logo .dot {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; font-weight: 800; color: #fff;
}
.login-logo h1 { font-size: 1.2rem; font-weight: 700; margin: 0; }
.login-tabs {
    display: flex; background: #f1f5f9; border-radius: 8px;
    padding: 3px; gap: 3px; margin-bottom: 22px;
}
.login-tab {
    flex: 1; text-align: center; padding: 7px;
    border-radius: 6px; cursor: pointer;
    font-size: .85rem; font-weight: 500; color: var(--text-muted);
    transition: .15s;
}
.login-tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.text-muted { color: var(--text-muted); }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-0 { margin-bottom: 0; }
.fw-600 { font-weight: 600; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
a { color: var(--primary); }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spin {
    display: inline-block; width: 18px; height: 18px;
    border: 2px solid #e2e8f0; border-top-color: var(--primary);
    border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Deploy log stream ────────────────────────────────────────────────────── */
.log-box {
    background: #1e293b; color: #94a3b8;
    border-radius: 8px; padding: 14px 16px;
    font-family: 'Courier New', monospace; font-size: .78rem;
    line-height: 1.7; min-height: 60px;
}
.log-box .log-ok    { color: #4ade80; }
.log-box .log-err   { color: #f87171; }
.log-box .log-step  { color: #f97316; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); }
    #main { margin-left: 0; padding: 20px 16px; }
}
