/* iCameraPlus — Style */
:root {
    --bg: #0d1117;
    --surface: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --primary: #f59e0b;
    --ok: #3fb950;
    --err: #f85149;
    --link: #58a6ff;
}

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

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

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

/* Nav */
.nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: .75rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.nav-brand { font-weight: 700; font-size: 1.1rem; color: var(--primary); }
.nav-user { color: var(--muted); font-size: .85rem; }
.nav-link { color: var(--muted); font-size: .85rem; padding: .4rem .7rem; border-radius: 4px; }
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--border); text-decoration: none; }

/* Page */
.page-wrap { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.center-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; }

/* Card */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
}
.brand {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

/* Form */
.form-group { margin-bottom: 1rem; }
.label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .35rem; font-weight: 600; }
.input {
    width: 100%; padding: .55rem .75rem;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); font-size: .9rem;
    outline: none;
}
.input:focus { border-color: var(--primary); }

/* Buttons */
.btn {
    display: inline-block; padding: .45rem .9rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); font-size: .82rem;
    cursor: pointer; text-decoration: none; line-height: 1.4;
}
.btn:hover { background: var(--border); text-decoration: none; }
.btn-primary { background: var(--primary); color: #000; border-color: var(--primary); font-weight: 600; }
.btn-primary:hover { opacity: .9; }
.btn-sm { padding: .25rem .55rem; font-size: .75rem; }
.btn-ok { color: var(--ok); border-color: var(--ok); }
.btn-err { color: var(--err); border-color: var(--err); }

/* Alert */
.alert { padding: .65rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: .85rem; }
.alert-ok { background: rgba(63,185,80,.12); color: var(--ok); border: 1px solid rgba(63,185,80,.3); }
.alert-err { background: rgba(248,81,73,.12); color: var(--err); border: 1px solid rgba(248,81,73,.3); }

/* Layout */
.layout { display: flex; gap: 1.25rem; min-height: calc(100vh - 140px); }

/* Sidebar */
.sidebar {
    width: 200px; flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .75rem;
    align-self: flex-start;
    position: sticky; top: 70px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
}
.sidebar-section { margin-bottom: 1.25rem; }
.sidebar-label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: .5rem; }
.sidebar-link {
    display: flex; justify-content: space-between; align-items: center;
    padding: .35rem .5rem; border-radius: 4px;
    color: var(--muted); font-size: .82rem; text-decoration: none;
}
.sidebar-link:hover { color: var(--text); background: rgba(255,255,255,.04); text-decoration: none; }
.sidebar-link.active { color: var(--primary); background: rgba(245,158,11,.08); }

/* Badge */
.badge { font-size: .7rem; padding: .1rem .4rem; border-radius: 10px; background: var(--border); color: var(--muted); }
.badge-ok { background: rgba(63,185,80,.15); color: var(--ok); }
.badge-err { background: rgba(248,81,73,.15); color: var(--err); }
.badge-off { background: rgba(139,148,158,.15); color: var(--muted); }

/* Main */
.main { flex: 1; min-width: 0; }

/* Topbar */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem; padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.1rem; font-weight: 600; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.clip-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s;
}
.clip-card:hover { border-color: var(--primary); }
.clip-thumb {
    height: 120px;
    background: #000;
    display: flex; justify-content: center; align-items: center;
}
.play-btn {
    width: 44px; height: 44px;
    background: rgba(245,158,11,.85);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 18px; color: #000;
}
.clip-info { padding: .6rem .75rem; }
.clip-name { font-size: .8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip-meta { font-size: .72rem; color: var(--muted); margin-top: .2rem; }

/* Empty */
.empty-state { text-align: center; padding: 3rem; color: var(--muted); }

/* Pagination */
.pagination { display: flex; gap: .4rem; margin-top: 1.25rem; justify-content: center; }

/* Modal */
.modal {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.75);
    z-index: 200;
    justify-content: center; align-items: center;
}
.modal.open { display: flex; }
.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 90%; max-width: 800px;
    overflow: hidden;
}
.modal-hdr {
    display: flex; justify-content: space-between; align-items: center;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.modal-ftr { padding: .5rem 1rem; border-top: 1px solid var(--border); }

/* Table */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}
th, td {
    text-align: left;
    padding: .55rem .75rem;
    border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; }
tr:hover { background: rgba(255,255,255,.02); }
.mono { font-family: 'Courier New', monospace; font-size: .78rem; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem; margin-bottom: 1.5rem; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}
.stat-label { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 1.6rem; font-weight: 700; margin-top: .35rem; color: var(--primary); }

/* Section */
.section-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.section-hdr h2 { font-size: 1.15rem; font-weight: 600; }

/* Log */
.log-hdr {
    display: flex; justify-content: space-between; align-items: center;
    padding: .5rem .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px 6px 0 0;
    font-weight: 600; font-size: .85rem;
}
.log-content {
    background: #111;
    color: #ccc;
    font-family: 'Courier New', monospace;
    font-size: .78rem;
    line-height: 1.7;
    white-space: pre-wrap;
    padding: 1rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
}

/* Icons */
.icon-ok { font-size: 2.5rem; color: var(--ok); margin-bottom: .75rem; }
.icon-err { font-size: 2.5rem; color: var(--err); margin-bottom: .75rem; }

/* Muted */
.muted { color: var(--muted); }

/* Responsive */
@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; position: static; max-height: none; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .nav { flex-wrap: wrap; gap: .5rem; }
}
