/* TOMRUK — Kurumsal Endüstriyel Tema */

:root {
    --color-primary: #2e7d32;
    --color-primary-dark: #1b5e20;
    --color-primary-light: #4caf50;
    --color-accent: #ff8f00;
    --color-bg: #f5f5f5;
    --color-surface: #ffffff;
    --color-text: #212121;
    --color-text-muted: #757575;
    --color-border: #e0e0e0;
    --color-success: #2e7d32;
    --color-warning: #f57c00;
    --color-error: #c62828;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: #1a1a2e;
    color: #e0e0e0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 28px; }
.logo-text { font-size: 20px; font-weight: 700; letter-spacing: 2px; color: #fff; }

.sidebar-nav { padding: 12px 0; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 20px;
    color: #b0b0b0;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 13.5px;
    border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(46,125,50,0.15); color: #4caf50; border-left-color: #4caf50; }
.nav-icon { font-size: 18px; width: 24px; text-align: center; }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow);
}

.sidebar-toggle {
    display: none;
    background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px;
}

.page-title { font-size: 18px; font-weight: 600; flex: 1; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-info { font-size: 13px; color: var(--color-text-muted); }

.content { padding: 24px; }

/* Guest Layout */
.guest-layout {
    background: linear-gradient(135deg, #1a1a2e 0%, #2e7d32 100%);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
}

.guest-container { width: 100%; max-width: 440px; padding: 20px; }

.login-card, .install-card {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: var(--shadow-md);
}

.login-header { text-align: center; margin-bottom: 28px; }
.logo-icon-lg { font-size: 48px; display: block; margin-bottom: 8px; }
.login-header h1 { font-size: 28px; font-weight: 700; color: var(--color-primary-dark); letter-spacing: 3px; }
.login-header p { color: var(--color-text-muted); margin-top: 4px; }
.login-header h3 { margin: 20px 0 12px; font-size: 15px; color: var(--color-text); text-align: left; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--color-text); }
.form-group input, .form-group select, .form-group textarea,
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font);
    transition: border-color 0.2s;
    background: #fff;
}
.form-group input:focus, .form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(46,125,50,0.15);
}

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

.login-form .form-group input { padding: 12px 14px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 20px;
    border: none; border-radius: var(--radius);
    font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all 0.2s;
    font-family: var(--font);
    text-decoration: none;
    gap: 6px;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-text); }
.btn-outline:hover { background: var(--color-bg); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* Cards */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-sm { padding: 16px; }
.card-warning { border-left: 4px solid var(--color-warning); }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--color-primary);
}
.stat-card-accent { border-left-color: var(--color-accent); }
.stat-card-success { border-left-color: var(--color-success); }
.stat-card-warning { border-left-color: var(--color-warning); }

.stat-label { font-size: 12px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--color-text); line-height: 1.2; }
.stat-value-sm { font-size: 18px; }
.stat-value-lg { font-size: 36px; text-align: center; padding: 10px 0; }
.stat-unit { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }

/* Dashboard Grid */
.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 1200px) { .dashboard-grid { grid-template-columns: 1fr 1fr; } }

.detail-grid { display: grid; gap: 20px; }

.detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    padding: 20px;
}
.detail-stat { display: flex; flex-direction: column; }
.detail-label { font-size: 12px; color: var(--color-text-muted); }
.detail-value { font-size: 18px; font-weight: 600; margin-top: 4px; }

/* Tables */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    background: #fafafa;
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-text-muted);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}
.table td { padding: 10px 16px; border-bottom: 1px solid var(--color-border); }
.table tbody tr:hover { background: #fafafa; }
.table-sm td, .table-sm th { padding: 6px 12px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-approved, .badge-measured { background: #e8f5e9; color: #2e7d32; }
.badge-manual_review, .badge-pending { background: #fff3e0; color: #e65100; }
.badge-detected { background: #e3f2fd; color: #1565c0; }
.badge-rejected { background: #ffebee; color: #c62828; }
.badge-open { background: #e8f5e9; color: #2e7d32; }
.badge-closed { background: #f5f5f5; color: #757575; }
.badge-in_progress { background: #e3f2fd; color: #1565c0; }
.badge-completed { background: #e8f5e9; color: #2e7d32; }
.badge-cancelled { background: #ffebee; color: #c62828; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13.5px; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-error { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }

/* Pagination */
.pagination { display: flex; gap: 4px; padding: 16px 20px; justify-content: center; }
.page-link {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    text-decoration: none;
    font-size: 13px;
}
.page-link.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.page-link:hover { background: var(--color-bg); text-decoration: none; }

/* Filters */
.page-actions { margin-bottom: 20px; }
.filter-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-form .form-control { width: auto; min-width: 150px; }

/* Camera */
.camera-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.camera-viewport {
    position: relative;
    background: #111;
    min-height: 400px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 0 0 var(--radius) var(--radius);
    overflow: hidden;
}
.camera-viewport img { max-width: 100%; max-height: 500px; }
.camera-placeholder { text-align: center; color: #888; padding: 40px; }
.placeholder-icon { font-size: 48px; display: block; margin-bottom: 12px; }

.camera-status { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-online { background: #4caf50; }
.status-offline { background: #f44336; }

.camera-sidebar .card { margin-bottom: 16px; }
.service-info { padding: 16px 20px; }
.info-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--color-border); }
.info-row:last-child { border-bottom: none; }
.last-log-info { padding: 16px 20px; }
.last-log-info p { margin: 4px 0; font-size: 13.5px; }

/* SVG Preview */
.svg-preview { padding: 20px; text-align: center; }
.svg-preview svg { max-width: 100%; height: auto; }

/* Chart */
.chart-container { padding: 16px 20px; height: 280px; position: relative; }

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 12px; }

/* Responsive */
@media (max-width: 1024px) {
    .camera-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .content { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .filter-form { flex-direction: column; }
    .filter-form .form-control { width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card, .install-card { padding: 28px 20px; }
}
