:root {
    --bg-dark: #0f172a;
    --panel-bg: #1e293b;
    --accent-blue: #3b82f6;
    --accent-yellow: #eab308;
    --accent-red: #ef4444;
    --accent-green: #22c55e;
    --accent-purple: #a855f7;
    --text-white: #f8fafc;
    --text-gray: #94a3b8;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: 'Inter', sans-serif;
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Nav */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background-color: #111827;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.logo-area { display: flex; align-items: center; gap: 10px; }
.logo-text { font-weight: 800; font-size: 1.4rem; }
.logo-text span { color: var(--accent-blue); }

.nav-center {
    display: flex;
    align-items: center;
    gap: 30px;
}

.mode-toggle {
    display: flex;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 4px;
}
.mode-btn {
    background: transparent;
    border: none;
    color: var(--text-gray);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}
.mode-btn.active {
    background: var(--accent-blue);
    color: white;
}

.target-angle-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}
.target-angle-wrap input {
    width: 50px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--accent-yellow);
    color: var(--accent-yellow);
    font-weight: bold;
    font-size: 1rem;
    text-align: center;
    outline: none;
}
#setTargetBtn {
    background: var(--accent-yellow);
    color: black;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}
.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-gray);
    background: rgba(255,255,255,0.05);
    padding: 6px 12px;
    border-radius: 20px;
}
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: gray;
}
.system-status.active .status-dot {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}
.system-status.active span { color: var(--text-white); }

.nav-back-btn {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
}

/* Main Container */
.main-container {
    display: flex;
    gap: 24px;
    padding: 24px;
    flex: 1;
    overflow: hidden;
}

.panel {
    background: var(--panel-bg);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
}
.left-panel { flex: 1; transition: flex 0.3s; }
.right-panel { flex: 1; position: relative; }

/* Layout Adjustments for Views */
.view-olcum .left-panel {
    flex: 2.5; /* Make left panel wider in Olcum view */
}
.view-olcum .right-panel {
    flex: 1; 
}
.view-animasyon .left-panel {
    flex: 1;
}
.view-animasyon .right-panel {
    flex: 1;
}

/* Visibility toggling */
.view-olcum .animasyon-content { display: none; }
.view-olcum .olcum-content { display: flex; flex-direction: column; gap: 20px; padding: 20px; flex: 1; height: 100%; }
.view-olcum .angle-type-buttons { display: flex; }

.view-animasyon .animasyon-content { display: flex; height: 100%; flex-direction: column; }
.view-animasyon .olcum-content { display: none; }
.view-animasyon .angle-type-buttons { display: none; }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.panel-header h2 {
    font-size: 1.1rem;
    margin: 0;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}
.red-badge { background: var(--accent-red); color: white; }
.blue-badge { background: var(--accent-blue); color: white; }

.animation-select {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 6px;
    outline: none;
}
.animation-select option {
    background: #1e293b; /* Koyu arka plan */
    color: white;
}

/* Camera Wrapper */
.camera-wrapper {
    position: relative;
    flex: 1;
    margin: 20px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}
#videoElement, #overlayCanvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror */
}
#overlayCanvas { z-index: 10; }

.task-badge {
    position: absolute;
    top: 16px; left: 16px;
    background: rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 8px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.task-label { color: var(--accent-yellow); font-size: 0.7rem; font-weight: bold; }
.task-value { font-size: 1.5rem; font-weight: 900; }

.current-angle-badge {
    position: absolute;
    top: 16px; right: 16px;
    background: rgba(0,0,0,0.6);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 900;
    z-index: 20;
}

.camera-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
}
.camera-overlay.hidden { display: none; }

.btn-primary {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: bold;
}

/* Angle Type Buttons */
.angle-type-buttons {
    display: flex;
    justify-content: space-between;
    padding: 0 20px 20px 20px;
    gap: 12px;
}
.angle-btn {
    flex: 1;
    background: #111827;
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-gray);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.angle-btn.active {
    border-color: #06b6d4; /* cyan */
    color: white;
}

/* Info Cards */
.info-card {
    background: #111827;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.info-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
}
.card-yellow::before { background: var(--accent-yellow); box-shadow: 0 0 10px var(--accent-yellow); }
.card-purple::before { background: var(--accent-purple); box-shadow: 0 0 10px var(--accent-purple); }
.card-orange::before { background: #f97316; box-shadow: 0 0 10px #f97316; }

.info-card h3 { margin-top: 0; margin-bottom: 8px; color: var(--accent-yellow); font-size: 1.1rem; }
.card-purple h3 { color: var(--accent-purple); }
.card-orange h3 { color: #f97316; }

.info-card p { margin: 0; font-size: 0.95rem; line-height: 1.5; color: var(--text-white); }
.info-card p strong { color: white; }

.progress-bar-wrap {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    margin-top: 16px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-purple);
    box-shadow: 0 0 8px var(--accent-purple);
    transition: width 0.3s ease;
}


/* Animation Stage */
.animation-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.door-container {
    perspective: 800px;
    width: 200px;
    height: 300px;
    margin-bottom: 40px;
}
.door-frame {
    width: 100%; height: 100%;
    border: 8px solid #334155;
    border-radius: 8px;
    position: relative;
    background: #0f172a;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
    transform-style: preserve-3d;
}
.door-panel {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #a3e635;
    transform-origin: left;
    transition: transform 0.1s ease-out;
    border: 2px solid white;
    border-right: 12px solid #4d7c0f; /* 3D kalınlık hissi */
    border-radius: 2px;
    box-sizing: border-box;
    box-shadow: 10px 0 20px rgba(0,0,0,0.4);
    transform: rotateY(0deg);
}

.animation-label {
    font-size: 1.2rem;
    color: var(--text-gray);
    font-weight: 600;
}

.mic-btn {
    position: absolute;
    bottom: 24px; right: 24px;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
}

/* Light Theme Overrides */
[data-theme="light"] {
    --bg-dark: #f8fafc;
    --panel-bg: rgba(255, 255, 255, 0.7); /* make panel slightly transparent */
    --text-white: #0f172a;
    --text-gray: #64748b;
}

[data-theme="light"] body {
    background: var(--navy-800);
}

/* Background Blobs for movement */
.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: blobFloat 15s infinite alternate;
}
.blob-1 { top: -10%; left: -10%; width: 50vw; height: 50vw; background: var(--accent-pink); opacity: 0.15; }
.blob-2 { bottom: -10%; right: -10%; width: 60vw; height: 60vw; background: var(--accent-purple); animation-delay: -5s; opacity: 0.15; }
.blob-3 { top: 40%; left: 40%; width: 40vw; height: 40vw; background: var(--accent-cyan); animation-delay: -10s; opacity: 0.1; }

@keyframes blobFloat {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(5%, 5%) scale(1.1); }
    100% { transform: translate(-5%, 10%) scale(0.9); }
}

[data-theme="light"] .top-nav { background-color: rgba(255, 255, 255, 0.8); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(226, 232, 240, 0.8); }
[data-theme="light"] .mode-toggle { background: #f1f5f9; }
[data-theme="light"] .mode-btn { color: #64748b; }
[data-theme="light"] .mode-btn.active { background: var(--accent-blue); color: white; }
[data-theme="light"] .target-angle-wrap input { color: #0f172a; border-bottom: 1px solid var(--accent-blue); }
[data-theme="light"] #setTargetBtn { background: var(--accent-blue); color: white; }

[data-theme="light"] .system-status { background: #f1f5f9; color: #64748b; }
[data-theme="light"] .system-status.active span { color: #0f172a; }
[data-theme="light"] .nav-back-btn { color: #0f172a; border-color: #cbd5e1; }

[data-theme="light"] .panel { border: 2px solid #f472b6; box-shadow: 0 8px 32px 0 rgba(244, 114, 182, 0.15); backdrop-filter: blur(8px); }
[data-theme="light"] .panel-header { border-bottom: 2px solid #fdf2f8; }
[data-theme="light"] .animation-select { background: #f1f5f9; color: #0f172a; border-color: #f472b6; }
[data-theme="light"] .animation-select option { background: #ffffff; color: #0f172a; }

[data-theme="light"] .angle-btn { background: #ffffff; border: 2px solid #f472b6; color: #475569; }
[data-theme="light"] .angle-btn.active { border-color: #db2777; color: #db2777; background: #fdf2f8; }

[data-theme="light"] .info-card { background: #ffffff; border: 2px solid #f472b6; }
[data-theme="light"] .info-card h3 { color: #0f172a; }
[data-theme="light"] .card-purple h3 { color: var(--accent-purple); }
[data-theme="light"] .card-orange h3 { color: #f97316; }
[data-theme="light"] .info-card p { color: #475569; }
[data-theme="light"] .info-card p strong { color: #0f172a; }
[data-theme="light"] .progress-bar-wrap { background: #fdf2f8; }

[data-theme="light"] .door-frame { background: #f8fafc; border: 2px solid #f472b6; box-shadow: inset 0 0 10px rgba(0,0,0,0.05); }
[data-theme="light"] .mic-btn { background: #ffffff; color: #db2777; border: 2px solid #f472b6; }
[data-theme="light"] .camera-wrapper { border: 2px solid #f472b6; }

/* Clock Animation */
.clock-container {
    width: 200px;
    height: 200px;
    margin-bottom: 40px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.clock-face {
    width: 100%; height: 100%;
    border: 8px solid #334155;
    border-radius: 50%;
    position: relative;
    background: #f8fafc;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1), 0 10px 20px rgba(0,0,0,0.3);
}
[data-theme="dark"] .clock-face {
    background: #1e293b;
    border-color: #475569;
}
.clock-marker {
    position: absolute;
    top: 50%; left: 50%;
    width: 12px; height: 4px;
    background: #94a3b8;
    margin-top: -2px;
    margin-left: -6px;
}
.clock-center {
    position: absolute;
    top: 50%; left: 50%;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #0f172a;
    transform: translate(-50%, -50%);
    z-index: 10;
}
[data-theme="dark"] .clock-center { background: #f8fafc; }

.clock-hand {
    position: absolute;
    top: 50%; left: 50%;
    width: 70px; height: 6px;
    transform-origin: 0 50%;
    border-radius: 3px;
    margin-top: -3px;
}
.clock-hand-fixed {
    background: #64748b;
    transform: rotate(-90deg); /* 12 o'clock */
}
.clock-hand-moving {
    background: #ef4444; /* Red hand */
    transition: transform 0.1s ease-out;
}
