/* ── Drone Cloud Frontend Styles ─────────────────────────────────────── */

:root {
    --bg-primary: #0f1117;
    --bg-card: #1a1d28;
    --bg-input: #252836;
    --accent: #4f8cff;
    --accent-hover: #3a6fcc;
    --green: #2ecc71;
    --red: #e74c3c;
    --yellow: #f1c40f;
    --text-primary: #e8e8e8;
    --text-secondary: #8b8fa3;
    --border: #2d3044;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

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

/* ── Layout ─────────────────────────────────────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 30px 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}

header h1 { font-size: 1.8rem; }
header .subtitle { color: var(--text-secondary); margin-top: 5px; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.card h2 { font-size: 1.1rem; margin-bottom: 12px; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    color: #fff;
}

.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
}
.form-group input:focus { outline: none; border-color: var(--accent); }

/* ── Status badges ──────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-online { background: rgba(46, 204, 113, 0.2); color: var(--green); }
.badge-offline { background: rgba(231, 76, 60, 0.2); color: var(--red); }

/* ── Device grid ────────────────────────────────────────────────────── */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.device-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.device-card h3 { font-size: 1.1rem; }

.device-card .actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* ── Table ──────────────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
th { color: var(--text-secondary); font-size: 0.8rem; text-transform: uppercase; }

/* ── Login page ─────────────────────────────────────────────────────── */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}
.login-box h2 { text-align: center; margin-bottom: 24px; }
.login-box .error {
    color: var(--red);
    font-size: 0.85rem;
    margin-bottom: 12px;
    display: none;
}

/* ── Control page ───────────────────────────────────────────────────── */
.control-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 20px;
}

.status-panel .status-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.channel-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.75rem;
}
.channel-bar .bar-bg {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}
.channel-bar .bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.05s;
}

#videoContainer {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}
#videoContainer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#videoContainer .placeholder {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ── Nav ────────────────────────────────────────────────────────────── */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}
.nav-bar .nav-links { display: flex; gap: 16px; }
.nav-bar .nav-links a { color: var(--text-secondary); font-size: 0.9rem; }
.nav-bar .nav-links a:hover, .nav-bar .nav-links a.active { color: var(--text-primary); }
.nav-bar .user-info { display: flex; align-items: center; gap: 12px; font-size: 0.85rem; color: var(--text-secondary); }

/* ── Modal ──────────────────────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal.hidden { display: none; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .control-layout { grid-template-columns: 1fr; }
}
