/* ============================================================
   TEKNİK BAKIM & ONARIM YÖNETİM SİSTEMİ - ANA CSS
   ============================================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active-bg: rgba(99,102,241,0.25);
    --sidebar-border: rgba(255,255,255,0.07);
    --topbar-height: 60px;
    --primary: #6366f1;
    --transition: all 0.25s ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f1f5f9; color: #1e293b; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed; top: 0; left: 0; width: var(--sidebar-width);
    height: 100vh; background: var(--sidebar-bg);
    display: flex; flex-direction: column;
    z-index: 1000; transition: var(--transition);
    overflow: hidden;
}

.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--sidebar-border);
    min-height: var(--topbar-height);
}

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    color: #ffffff; font-weight: 700; font-size: 15px; text-decoration: none;
}

.sidebar-brand i { font-size: 24px; color: var(--primary); }

.sidebar-toggle { color: var(--sidebar-text) !important; padding: 4px 8px !important; }
.sidebar-toggle:hover { color: #fff !important; }

.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 20px; border-bottom: 1px solid var(--sidebar-border);
}

.user-avatar { font-size: 32px; color: var(--primary); flex-shrink: 0; }
.user-name  { color: #e2e8f0; font-weight: 600; font-size: 14px; }
.user-role  { font-size: 10px; background: rgba(99,102,241,0.3) !important; color: var(--primary) !important; }

.sidebar-nav { list-style: none; padding: 8px 0; margin: 0; flex: 1; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-section {
    padding: 8px 20px 4px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: rgba(148,163,184,0.6);
}

.nav-item .nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; color: var(--sidebar-text);
    text-decoration: none; font-size: 14px;
    border-radius: 0; transition: var(--transition);
    position: relative; white-space: nowrap; overflow: hidden;
}

.nav-item .nav-link i { font-size: 18px; flex-shrink: 0; min-width: 20px; text-align: center; }
.nav-item .nav-link:hover { color: var(--sidebar-active); background: var(--sidebar-hover); }
.nav-item .nav-link.active { color: var(--sidebar-active); background: var(--sidebar-active-bg); }
.nav-item .nav-link.active::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: var(--primary); border-radius: 0 4px 4px 0;
}

.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--sidebar-border); }
.sidebar-footer .nav-link { border-radius: 8px; margin: 0 8px; }
.sidebar-footer .nav-link:hover { background: rgba(220,53,69,0.15) !important; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: var(--transition);
}

.topbar {
    height: var(--topbar-height);
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center;
    padding: 0 20px;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-item  { display: flex; align-items: center; }

.page-content { padding: 24px; flex: 1; }
.footer { padding: 16px 24px; border-top: 1px solid #e2e8f0; }

/* Sidebar collapsed */
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
.sidebar-collapsed .sidebar .sidebar-brand span,
.sidebar-collapsed .sidebar .nav-item .nav-link span,
.sidebar-collapsed .sidebar .nav-section,
.sidebar-collapsed .sidebar .user-info,
.sidebar-collapsed .sidebar .badge { display: none !important; }
.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed); }
.sidebar-collapsed .sidebar-user { justify-content: center; }
.sidebar-collapsed .nav-item .nav-link { justify-content: center; padding: 12px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    border-radius: 12px; padding: 20px;
    display: flex; align-items: center; gap: 16px;
    color: #fff; border: none; box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-3px); }
.stat-card-primary { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.stat-card-danger  { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-card-success { background: linear-gradient(135deg, #22c55e, #16a34a); }
.stat-card-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }

.stat-icon { font-size: 42px; opacity: 0.85; }
.stat-value { font-size: 32px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 13px; opacity: 0.9; margin-top: 2px; }
.stat-sub   { font-size: 12px; opacity: 0.8; margin-top: 4px; }

/* ============================================================
   CARDS
   ============================================================ */
.card { border: 1px solid #e2e8f0; border-radius: 12px; }
.card-header { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 14px 20px; border-radius: 12px 12px 0 0 !important; }
.shadow-sm { box-shadow: 0 1px 4px rgba(0,0,0,0.07) !important; }

/* ============================================================
   AUTH PAGE
   ============================================================ */
.auth-body { background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }

.auth-wrapper { width: 100%; max-width: 440px; padding: 20px; z-index: 10; }

.auth-card { background: rgba(255,255,255,0.97); border-radius: 20px; padding: 40px; box-shadow: 0 25px 60px rgba(0,0,0,0.4); backdrop-filter: blur(10px); }

.auth-header { text-align: center; margin-bottom: 32px; }
.auth-logo { width: 72px; height: 72px; background: linear-gradient(135deg, #6366f1, #4f46e5); border-radius: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; box-shadow: 0 8px 24px rgba(99,102,241,0.4); }
.auth-logo i { font-size: 36px; color: #fff; }
.auth-title { font-size: 22px; font-weight: 800; color: #0f172a; margin: 0 0 4px; }
.auth-subtitle { color: #64748b; font-size: 13px; margin: 0; }

.btn-eye { background: transparent !important; border-color: #ced4da !important; cursor: pointer; }

/* Auth background gears */
.auth-bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.gear { position: absolute; font-size: 120px; color: rgba(255,255,255,0.03); animation: spin 20s linear infinite; }
.gear-1 { top: 10%; left: 5%; }
.gear-2 { bottom: 15%; right: 8%; font-size: 180px; animation-duration: 30s; animation-direction: reverse; }
.gear-3 { top: 60%; left: 55%; font-size: 90px; animation-duration: 15s; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ============================================================
   STATUS & PRIORITY BADGES
   ============================================================ */
.badge-status { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-active     { background: rgba(34,197,94,0.15); color: #16a34a; }
.badge-maintenance{ background: rgba(245,158,11,0.15); color: #d97706; }
.badge-fault      { background: rgba(239,68,68,0.15);  color: #dc2626; }
.badge-passive    { background: rgba(100,116,139,0.15);color: #64748b; }

/* ============================================================
   UPLOAD AREA
   ============================================================ */
.upload-area {
    border: 2px dashed #cbd5e1; border-radius: 12px; padding: 32px;
    text-align: center; cursor: pointer; transition: var(--transition);
    background: #f8fafc;
}
.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary); background: rgba(99,102,241,0.05);
}

/* ============================================================
   COMMENT
   ============================================================ */
.comment-item { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* ============================================================
   CALENDAR LEGEND
   ============================================================ */
.badge-legend { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; color: #fff; font-size: 12px; font-weight: 600; }

/* ============================================================
   MONOSPACE / CODE
   ============================================================ */
code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 12px; color: #6366f1; }
.fw-mono { font-family: 'Courier New', monospace; }

/* ============================================================
   FORM LABELS
   ============================================================ */
.form-label.required::after { content: ' *'; color: #dc2626; }

/* ============================================================
   TABLE
   ============================================================ */
.table > :not(caption) > * > * { padding: 12px 16px; }
.table-hover > tbody > tr:hover { background: rgba(99,102,241,0.04); }

/* ============================================================
   DATATABLES OVERRIDES
   ============================================================ */
.dataTables_wrapper .dataTables_filter input { border-radius: 8px !important; border-color: #e2e8f0 !important; }
.dataTables_wrapper .dataTables_length select { border-radius: 8px !important; }

/* ============================================================
   FULLCALENDAR OVERRIDES
   ============================================================ */
.fc .fc-button { background: #6366f1 !important; border-color: #6366f1 !important; border-radius: 8px !important; text-transform: capitalize !important; }
.fc .fc-button:hover { background: #4f46e5 !important; }
.fc .fc-button-active { background: #4f46e5 !important; }
.fc-event { cursor: pointer !important; border-radius: 6px !important; }
.fc-daygrid-event { font-size: 12px !important; }

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }

    .sidebar-overlay {
        display: none; position: fixed; inset: 0;
        background: rgba(0,0,0,0.5); z-index: 999;
    }
    .sidebar-overlay.active { display: block; }

    .stat-value { font-size: 26px; }
    .stat-icon  { font-size: 32px; }
}

@media (max-width: 576px) {
    .page-content { padding: 16px; }
    .stat-card { flex-direction: column; text-align: center; gap: 8px; }
    .auth-card { padding: 28px 20px; }
    .card-header { padding: 12px 16px; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.cursor-pointer { cursor: pointer; }
.object-fit-cover { object-fit: cover; }
.ratio { position: relative; } .ratio > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.ratio-1x1::before { padding-top: 100%; content: ''; display: block; }
