/* ============================================
   Modern 3D Box Optimization System
   Responsive Design with Modern Color Palette
   ============================================ */

/* ============================================
   Variables - Modern Color Palette
   ============================================ */
:root {
    /* Primary Colors */
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    
    /* Secondary Colors */
    --secondary: #7c3aed;
    --secondary-dark: #6d28d9;
    
    /* Success / Accent */
    --success: #10b981;
    --success-dark: #059669;
    
    /* Warning */
    --warning: #f59e0b;
    
    /* Danger */
    --danger: #ef4444;
    
    /* Grays */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* UI Colors */
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --text-light: #f1f5f9;
    --text-muted: #94a3b8;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Reset & Base
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--gray-900);
    color: var(--text-light);
    overflow: hidden;
}

/* ============================================
   Header - Flexbox Layout
   ============================================ */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    gap: 1rem;
}

/* Header Sol Grup (Logo + Brand) */
.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.header-logo {
    max-height: 50px;
    height: auto;
    width: auto;
    max-width: 180px;
    cursor: pointer;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.header-logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.brand-icon {
    width: 28px;
    height: 28px;
    stroke-width: 2;
    flex-shrink: 0;
}

/* Header Sağ Grup (Dil + User) */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-name {
    font-size: 0.95rem;
    opacity: 0.95;
}

/* ============================================
   Container Layout
   ============================================ */
.container {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: 320px;
    background: var(--gray-800);
    padding: 1.5rem;
    overflow-y: auto;
    border-right: 1px solid var(--gray-700);
    scrollbar-width: thin;
    scrollbar-color: var(--gray-600) var(--gray-800);
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--gray-800);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--gray-600);
    border-radius: 4px;
}

.section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--gray-700);
    border-radius: 8px;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-light);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.select-input {
    width: 100%;
    padding: 0.625rem;
    background: var(--gray-600);
    border: 1px solid var(--gray-500);
    border-radius: 6px;
    color: var(--text-light);
    font-size: 0.9rem;
    transition: var(--transition);
}

.select-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Box List */
.box-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.box-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem;
    background: var(--gray-600);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: var(--transition);
}

.box-item:hover {
    background: var(--gray-500);
}

.box-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.loading-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    padding: 1rem;
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--gray-600);
    color: var(--text-light);
}

.btn-secondary:hover {
    background: var(--gray-500);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: var(--success-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.floating-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: auto;
    padding: 1rem 2rem;
    box-shadow: var(--shadow-xl);
    z-index: 50;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.stat-item {
    background: var(--gray-600);
    padding: 0.75rem;
    border-radius: 6px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-light);
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-darker);
    overflow: hidden;
}

/* 3D Viewer */
.viewer-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#threeCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-600);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 1rem;
    color: var(--text-light);
    font-size: 1rem;
}

.viewer-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 5;
}

.control-btn {
    width: 44px;
    height: 44px;
    background: rgba(31, 41, 55, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--gray-600);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.control-btn svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-light);
    stroke-width: 2;
}

.control-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Box Navigation Tabs */
.box-navigation {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--gray-800);
    border-top: 1px solid var(--gray-700);
    overflow-x: auto;
    min-height: 60px; /* Boşken bile yer kaplasın */
}

.box-tab {
    padding: 0.625rem 1.25rem;
    background: var(--gray-700);
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
}

.box-tab:hover {
    background: var(--gray-600);
}

.box-tab.active {
    background: var(--primary);
    border-color: var(--primary-light);
    color: white;
}

/* Info Panel */
.info-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-800);
    border-top: 1px solid var(--gray-700);
    min-height: 200px; /* Boşken bile yer kaplasın */
    max-height: 300px; /* Maksimum yükseklik artırıldı */
    overflow-y: auto;
}

.info-section {
    background: var(--gray-700);
    padding: 0.75rem;
    border-radius: 6px;
}

.info-section h4 {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

#boxInfo, #legend, #productList {
    font-size: 0.825rem;
    line-height: 1.5;
}

#legend .legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

#legend .legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .info-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--gray-700);
    }
    
    .main-content {
        height: 60vh;
    }
    
    .floating-btn {
        bottom: 1rem;
        right: 1rem;
        padding: 0.75rem 1.5rem;
    }
    
    .box-navigation {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.75rem 1rem;
    }
    
    .logo {
        font-size: 1rem;
    }
    
    .logo-icon {
        width: 24px;
        height: 24px;
    }
    
    .sidebar {
        padding: 1rem;
    }
    
    .section {
        padding: 0.75rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .fixed-logo {
        max-width: 120px;
        top: 15px;
        left: 15px;
        padding: 10px;
    }
}

/* Responsive Header */
@media (max-width: 1024px) {
    .brand span {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.875rem 1.5rem;
    }
    
    .header-logo {
        max-height: 40px;
        max-width: 140px;
    }
    
    .brand {
        font-size: 1.1rem;
    }
    
    .brand span {
        display: none; /* Başlık gizlenir */
    }
    
    .brand-icon {
        width: 24px;
        height: 24px;
    }
    
    .user-name {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    
    .header-left {
        gap: 0.5rem;
    }
    
    .header-logo {
        max-height: 35px;
        max-width: 110px;
    }
    
    .brand-icon {
        width: 20px;
        height: 20px;
    }
    
    .header-right {
        gap: 0.5rem;
    }
    
    .user-name {
        display: none; /* Admin yazısı gizlenir */
    }
}

