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

/* Font Face Definitions */
@font-face {
    font-family: 'Splash Script';
    src: url('../assets/fonts/Splash%20Script.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Splash Underline';
    src: url('../assets/fonts/Splash%20Underline.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Root Variables */
:root {
    --primary-color: #4169e1;
    --bg-color: #ffffff;
    --sidebar-bg: #f5f5f5;
    --inspector-bg: #f5f5f5;
    --text-color: #1a1a1a;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --sidebar-width: 280px;
    --inspector-width: 320px;
    --header-height: 50px;
    --timeline-height: 200px;
}

/* Body */
body {
    font-family: 'Lexend', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow: hidden;
    height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: relative;
    z-index: 100;
    gap: 10px;
    justify-content: space-between;
}

.logo {
    font-family: 'Splash Script', cursive;
    font-size: 28px;
    color: var(--primary-color);
    margin-right: 30px;
    font-weight: normal;
}

.tabs {
    display: flex;
    gap: 5px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: 'Lexend', sans-serif;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.tab-btn:hover {
    background-color: rgba(65, 105, 225, 0.1);
    color: var(--text-color);
}

.tab-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* Header Buttons */
.header-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-family: 'Lexend', sans-serif;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.header-btn:hover {
    background-color: rgba(65, 105, 225, 0.1);
    border-color: var(--primary-color);
    color: var(--text-color);
}

.header-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.inspector-toggle {
    margin-left: auto;
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - var(--header-height));
    position: relative;
    transition: height 0.3s ease;
}

.main-container.timeline-visible {
    height: calc(100vh - var(--header-height) - var(--timeline-height));
}

/* Sidebar Toggle Buttons */
.sidebar-toggle {
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    color: var(--text-secondary);
    position: absolute;
    top: 10px;
    z-index: 10;
}

.sidebar-toggle:hover {
    background-color: rgba(65, 105, 225, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.2s;
}

.sidebar-toggle-left {
    right: 10px;
}

.sidebar-toggle-right {
    left: 10px;
}

.sidebar .sidebar-toggle-left {
    right: 10px;
}

.inspector .sidebar-toggle-right {
    left: 10px;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform 0.3s ease, width 0.3s ease;
    position: relative;
}

.sidebar[data-visible="false"] {
    width: 0;
    transform: translateX(-100%);
    border-right: none;
    overflow: hidden;
}

.sidebar-content {
    padding: 20px;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    transition: width 0.3s ease;
    min-width: 0; /* Flexbox overflow için */
}

#scene-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
    z-index: 1;
    pointer-events: auto; /* OrbitControls için gerekli */
    touch-action: none;
}

#overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
    z-index: 2;
    pointer-events: none; /* Overlay modülü aktif değilken event'leri scene-canvas'a geçir */
    touch-action: none;
}

/* Overlay modülü aktifken overlay-canvas pointer-events'i aç, scene-canvas'ı kapat */
body.overlay-active #overlay-canvas {
    pointer-events: auto; /* Overlay canvas etkileşimleri aktif */
}

body.overlay-active #scene-canvas {
    pointer-events: none;
}

/* Inspector */
.inspector {
    width: var(--inspector-width);
    background-color: var(--inspector-bg);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform 0.3s ease, width 0.3s ease;
    position: relative;
}

.inspector[data-visible="false"] {
    width: 0;
    transform: translateX(100%);
    border-left: none;
    overflow: hidden;
}

.inspector-content {
    padding: 20px;
}

/* Form Elements */
input, select, textarea, button {
    font-family: 'Lexend', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

button {
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: rgba(65, 105, 225, 0.2);
}

button.primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

button.primary:hover {
    background-color: #5a7de8;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #505050;
}

/* Module Styles */
.module-dosya, .module-ice-aktar, .module-sahne, .module-varyant,
.module-zaman, .module-overlay, .module-geo, .module-disa-aktar, .module-yayinla {
    padding: 10px 0;
}

.module-dosya h2, .module-ice-aktar h2, .module-sahne h2,
.module-varyant h2, .module-zaman h2, .module-overlay h2,
.module-geo h2, .module-disa-aktar h2, .module-yayinla h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-color);
    font-weight: 500;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
}

.btn:hover {
    background: rgba(65, 105, 225, 0.1);
    border-color: var(--primary-color);
}

.btn.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background: #5a7de8;
}

.btn-small:hover {
    background: rgba(65, 105, 225, 0.1);
    border-color: var(--primary-color);
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

li {
    padding: 8px;
    margin: 4px 0;
    background: var(--sidebar-bg);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

li:hover {
    background: rgba(65, 105, 225, 0.1);
}

li.selected {
    background: rgba(65, 105, 225, 0.2);
    border: 1px solid var(--primary-color);
}

/* Inspector Styles */
.inspector-panel {
    padding: 10px 0;
}

.property-group {
    margin-bottom: 15px;
}

.property-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.vector-input {
    display: flex;
    gap: 5px;
}

.vector-input input {
    flex: 1;
    padding: 6px;
    font-size: 12px;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 8px;
    font-size: 14px;
}

/* Timeline Container (Alt Kenar) */
.timeline-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--timeline-height);
    background-color: var(--sidebar-bg);
    border-top: 1px solid var(--border-color);
    z-index: 50;
    overflow: hidden;
    /* Sidebar durumundan bağımsız, her zaman tam genişlikte */
}

.timeline-content {
    width: 100%;
    height: 100%;
    padding: 10px 20px;
    overflow-y: auto;
}

.timeline-main {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.timeline-time {
    margin-left: auto;
    font-size: 14px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.timeline-track {
    flex: 1;
    position: relative;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 100px;
}

.timeline-ruler {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, #f9f9f9, #f0f0f0);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.timeline-keyframes {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Timeline Ruler */
.timeline-ruler {
    position: relative;
    height: 100%;
}

.timeline-tick {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background-color: var(--border-color);
    transform: translateX(-50%);
}

.timeline-tick:nth-child(5n) {
    background-color: var(--text-color);
    height: 100%;
}

.tick-label {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Timeline Keyframes */
.timeline-keyframe {
    position: absolute;
    top: 10px;
    width: 12px;
    height: 12px;
    background-color: var(--primary-color);
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    transform: translateX(-50%);
    z-index: 10;
    transition: all 0.2s;
}

.timeline-keyframe:hover {
    transform: translateX(-50%) scale(1.3);
    box-shadow: 0 0 8px rgba(65, 105, 225, 0.6);
}

.timeline-keyframe.selected {
    background-color: #ff6b6b;
    border-color: #ff4757;
    box-shadow: 0 0 12px rgba(255, 107, 107, 0.8);
}

/* Timeline Scrubber */
.timeline-scrubber {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background-color: #ff6b6b;
    z-index: 20;
    pointer-events: none;
    transform: translateX(-50%);
}

.timeline-scrubber::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #ff6b6b;
}

