:root {
    --bg-dark: #0a0e27;
    --bg-panel: #1a1f3a;
    --accent-blue: #4a9eff;
    --accent-cyan: #00d4ff;
    --text-primary: #e8eaf6;
    --text-secondary: #9fa8da;
    --success: #00e676;
    --warning: #ffd600;
    --error: #ff5252;
    --border: #2a3f5f;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #0d1b2a 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: var(--bg-panel);
    border-radius: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.status-badge {
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.status-connected {
    background: rgba(0, 230, 118, 0.15);
    color: var(--success);
    border: 2px solid var(--success);
    box-shadow: 0 0 20px rgba(0, 230, 118, 0.3);
}

.status-connecting {
    background: rgba(255, 214, 0, 0.15);
    color: var(--warning);
    border: 2px solid var(--warning);
    animation: pulse 2s infinite;
}

.status-disconnected {
    background: rgba(255, 82, 82, 0.15);
    color: var(--error);
    border: 2px solid var(--error);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Video Section */
.video-section {
    background: var(--bg-panel);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.video-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.video-overlay {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-cyan);
    border: 1px solid rgba(74, 158, 255, 0.3);
}

@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}

/* Telemetry Grid */
.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.card {
    background: var(--bg-panel);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--accent-cyan);
}

/* Motor Grid */
.motor-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 12px;
}

.motor-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 8px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.motor-box:hover {
    border-color: var(--accent-blue);
    transform: scale(1.05);
}

.motor-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.motor-value {
    font-size: 14px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--accent-cyan);
}

.motor-box.warning {
    border-color: var(--warning);
    background: rgba(255, 214, 0, 0.1);
}

.motor-box.warning .motor-value {
    color: var(--warning);
}

.motor-box.error {
    border-color: var(--error);
    background: rgba(255, 82, 82, 0.1);
}

.motor-box.error .motor-value {
    color: var(--error);
}

/* Log Console */
.log-console {
    background: #000;
    border-radius: 12px;
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    color: var(--success);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.log-console::-webkit-scrollbar {
    width: 8px;
}

.log-console::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.log-console::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 4px;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    background: var(--bg-panel);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.stat-mini {
    text-align: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.stat-mini-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-mini-value {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--accent-cyan);
}

/* Gimbal kamerasi (bina ici kesif) - tum genisligi kaplayan ana gorunum */
.video-primary {
    grid-column: 1 / -1;
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 4px 28px rgba(0, 212, 255, 0.35);
}

/* ===== Gimbal Kontrol Pad'i (SIYI A8) ===== */
.gimbal-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px 4px;
}

.gimbal-pad {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(0, 212, 255, 0.08), rgba(0, 0, 0, 0.35));
    border: 3px solid var(--accent-cyan);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    touch-action: none;
    user-select: none;
    margin-bottom: 16px;
}

/* Merkez cizgileri (yatay = yaw, dikey = pitch referansi) */
.gimbal-pad-cross-h,
.gimbal-pad-cross-v {
    position: absolute;
    background: rgba(159, 168, 218, 0.25);
}

.gimbal-pad-cross-h {
    top: 50%;
    left: 8%;
    right: 8%;
    height: 1px;
    transform: translateY(-0.5px);
}

.gimbal-pad-cross-v {
    left: 50%;
    top: 8%;
    bottom: 8%;
    width: 1px;
    transform: translateX(-0.5px);
}

.gimbal-knob {
    position: absolute;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    border: 2px solid #fff;
    box-shadow: 0 2px 12px rgba(74, 158, 255, 0.6);
    /* Baslangicta merkez: JS transform ile konumlanir */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.gimbal-readout {
    width: 100%;
    text-align: center;
    font-size: 13px;
    line-height: 1.6;
}

.gimbal-target {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--accent-cyan);
}

.gimbal-live {
    font-family: 'Courier New', monospace;
    color: var(--text-secondary);
    font-size: 12px;
}

.gimbal-conn-on {
    color: var(--success);
    font-weight: 700;
}

.gimbal-conn-off {
    color: var(--error);
    font-weight: 700;
}

.gimbal-hint {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    opacity: 0.8;
}
