/* Teknik Servis Yönetimi V2 - Custom Styles */
:root {
    --sidebar-width: auto;
    --topnav-height: 56px;
    --sidebar-bg: #212529;
    --sidebar-hover: #495057;
    --sidebar-active: #6c757d;
    --sidebar-text: #c4c4ce;
    --accent-color: #198209;
}

/* Global tipografi ölçeği:
   Bootstrap tüm boyutları rem cinsinden kullanır. Root font-size'ı
   16px'ten 13px'e düşürerek tüm sistem yazılarını bir kademe küçültüyoruz. */
html { font-size: 13px; }
/* Masaüstünde biraz daha büyük olsun (okunabilirlik dengesi için) */
@media (min-width: 1400px) { html { font-size: 14px; } }

* { box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f4f6f9; margin: 0; padding: 0; }

/* Top Navbar */
.top-nav { height: var(--topnav-height); z-index: 1040; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.top-nav .navbar-brand { font-size: 1rem; }

/* Wrapper */
.wrapper {
    display: flex; margin-top: var(--topnav-height);
    min-height: calc(100vh - var(--topnav-height));
}

/* Sidebar */
.sidebar {
    position: flex; top: var(--topnav-height); left: 0;
    width: var(--sidebar-width); min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    flex-shrink: 0;

    overflow-x: hidden; z-index: 1030;
    transition: transform 0.3s ease;
    scrollbar-width: none; -ms-overflow-style: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-header { border-bottom: 1px solid rgba(255,255,255,0.1); color: #fff; font-size: 0.75rem; letter-spacing: 1px; }

.sidebar .nav-link {
    color: var(--sidebar-text); padding: 10px 20px; font-size: 0.875rem;
    display: flex; align-items: center; text-decoration: none; transition: all 0.2s;
    border-left: 3px solid transparent;
}
.sidebar .nav-link:hover { background: var(--sidebar-hover); color: #fff; border-left-color: var(--accent-color); }
.sidebar .nav-link.active { background: var(--sidebar-active); color: #fff; border-left-color: var(--accent-color); }
.sidebar .nav-link i { width: 24px; font-size: 1rem; margin-right: 8px; text-align: center; }
.sidebar .nav-link .bi-chevron-down { margin-left: auto; font-size: 0.7rem; transition: transform 0.2s; }
.sidebar .nav-link[aria-expanded="true"] .bi-chevron-down { transform: rotate(90deg); }

.sidebar .sub-nav .nav-link {
    padding: 7px 20px 7px 52px; font-size: 0.8rem; color: rgba(196,196,206,0.8);
    border-left: 3px solid transparent;
}
.sidebar .sub-nav .nav-link:hover { color: #fff; background: var(--sidebar-hover); border-left-color: rgba(0,180,216,0.4); }
.sidebar .sub-nav .nav-link.active { color: #fff; background: var(--sidebar-active); border-left-color: var(--accent-color); font-weight: 600; }
.sidebar .sub-nav .nav-link i { font-size: 0.7rem; width: 20px; }

/* Main Content */
.main-content {
    flex: 1; min-width: 0;
    padding: 20px; padding-bottom: 50px;
}

/* Dashboard Cards */
.stat-card { border: none; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); transition: transform 0.2s; }
.stat-card:hover { transform: translateY(-2px); }
.stat-card .card-body { padding: 20px; }
.stat-card .stat-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.stat-card .stat-icon-lg { width: 60px; height: 60px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; flex-shrink: 0; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-card .stat-label { font-size: 0.8rem; color: #6c757d; text-transform: uppercase; }

/* Service Table */
.service-table { background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); overflow: hidden; }
.service-table .table { margin-bottom: 0; }
.service-table .table th { background: #f8f9fa; border-bottom: 2px solid #dee2e6; font-size: 0.8rem; text-transform: uppercase; color: #6c757d; }
.service-table .table td { vertical-align: middle; font-size: 0.875rem; }

/* Status Badges */
.status-badge { padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; color: #fff; }

/* Content Cards */
.content-card { background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); margin-bottom: 20px; overflow: hidden; }
.content-card .card-header { background: transparent; border-bottom: 1px solid #eee; font-weight: 600; }
.content-card .table-responsive { border-radius: 0; }
.content-card .table { margin-bottom: 0; }
.content-card .table thead th { background: #f8f9fa; font-size: 0.8rem; text-transform: uppercase; color: #6c757d; border-bottom: 2px solid #dee2e6; white-space: nowrap; }
.content-card .table td { vertical-align: middle; font-size: 0.875rem; }
.content-card .dataTables_wrapper { margin: 0; }
.content-card .dataTables_wrapper .dataTables_length,
.content-card .dataTables_wrapper .dataTables_filter { padding: 12px 16px 0; }
.content-card .dataTables_wrapper .dataTables_info,
.content-card .dataTables_wrapper .dataTables_paginate { padding: 8px 16px 12px; }
.content-card .dataTables_wrapper .table { border-radius: 0; }

/* Form Styling */
.form-card { background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); padding: 24px; }
.form-card .form-label { font-weight: 600; font-size: 0.85rem; color: #495057; }

/* Login Page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); }
.login-card { background: #fff; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); max-width: 420px; width: 100%; padding: 40px; }
.login-card .logo { font-size: 2rem; color: var(--accent-color); }

/* Mobile Responsive */
@media (max-width: 991.98px) {
    .wrapper { flex-direction: column; }
    .sidebar {
        position: fixed; top: var(--topnav-height); left: 0; bottom: 0;
        width: var(--sidebar-width); transform: translateX(-100%);
        z-index: 1050; overflow-y: auto;
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 12px; padding-bottom: 60px; }
}

/* Sidebar Backdrop (mobile) */
.sidebar-backdrop {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 1045;
}
.sidebar-backdrop.show { display: block; }

/* Tablet (max 991px) */
@media (max-width: 991.98px) {
    /* Stat cards: smaller values */
    .stat-card .stat-value { font-size: 1.25rem; }
    .stat-card .stat-icon-lg { width: 45px; height: 45px; font-size: 1.3rem; }
    .stat-card .card-body { padding: 14px; }

    /* Page title */
    .page-title { font-size: 1.1rem; margin-bottom: 12px; }
    .d-flex.justify-content-between { flex-wrap: wrap; gap: 8px; }

    /* Form cards: less padding */
    .form-card { padding: 16px; }

    /* Buttons in table cells: compact */
    .table td .btn-sm { padding: 2px 6px; font-size: 0.75rem; }
    .table td .btn-group .btn-sm { padding: 2px 5px; }

    /* DataTables controls: wrap */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        padding: 8px; font-size: 0.8rem;
    }
    .dataTables_wrapper .dataTables_filter { float: none !important; text-align: left; }
    .dataTables_wrapper .dataTables_length { float: none !important; margin-bottom: 8px; }

    /* Select2: fix width on mobile */
    .select2-container { width: 100% !important; }
    .select2-dropdown { z-index: 1070 !important; }

    /* Content card tables: tighter */
    .content-card .table td,
    .content-card .table th { padding: 6px 8px; font-size: 0.8rem; }

    /* Login page */
    .login-card { padding: 24px; margin: 12px; }
}

/* Phone (max 575px) */
@media (max-width: 575.98px) {
    .main-content { padding: 8px; padding-bottom: 65px; }

    /* Navbar: compact */
    .top-nav .navbar-brand { font-size: 0.85rem; }
    .top-nav .navbar-brand i { font-size: 1rem; }
    .top-nav .btn-sm { padding: 2px 6px; font-size: 0.8rem; }
    .top-nav .dropdown-toggle { font-size: 0.75rem; padding: 2px 5px; }

    /* Hide search icon text on phones */
    .top-nav .d-flex.gap-2 { gap: 4px !important; }

    /* Force table scroll with min-width */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .content-card .table { min-width: 600px; }
    .service-table .table { min-width: 600px; }

    /* Stat cards: stack on phone */
    .stat-card { margin-bottom: 8px; }
    .stat-card .stat-value { font-size: 1.1rem; }
    .stat-card .stat-label { font-size: 0.7rem; }

    /* Form: full width columns */
    .form-card .row > [class*='col-'] { margin-bottom: 8px; }

    /* Buttons: smaller text */
    .btn { font-size: 0.8rem; }
    .btn-sm { padding: 3px 8px; }

    /* Page title: smaller */
    .page-title { font-size: 1rem; }

    /* Filter row: stack */
    .card.content-card .row.g-2 { gap: 4px !important; }
    .card.content-card .col-auto { width: 100%; }

    /* Footer: smaller */
    .fixed-footer { padding: 5px 10px; }
    .fixed-footer small { font-size: 0.7rem; }

    /* SweetAlert2: mobile friendly */
    .swal2-popup { font-size: 0.9rem !important; padding: 1em !important; }

    /* Dropdown menus: adjust */
    .dropdown-menu { font-size: 0.85rem; min-width: 180px !important; }
}

/* Very small phones (max 375px) */
@media (max-width: 375px) {
    .top-nav .navbar-brand span { display: none; }
    .top-nav .navbar-brand i { margin-right: 0 !important; }
    .main-content { padding: 6px; padding-bottom: 65px; }
    .sidebar { width: 240px; }
}

/* Fixed Footer */
.fixed-footer {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--sidebar-bg); color: rgba(255,255,255,0.6);
    padding: 8px 20px; z-index: 1020;
    font-size: 0.8rem; border-top: 1px solid rgba(255,255,255,0.1);
}
.fixed-footer a { color: var(--accent-color); }
.fixed-footer a:hover { color: #fff; }

/* Misc */
.btn-primary { background-color: var(--accent-color); border-color: var(--accent-color); }
.btn-primary:hover { background-color: #0096c7; border-color: #0096c7; }
.page-title { font-size: 1.25rem; font-weight: 700; color: #2c3e50; margin-bottom: 20px; }
.breadcrumb-custom { background: transparent; padding: 0; margin-bottom: 15px; font-size: 0.85rem; }
.text-truncate-custom { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.empty-state { text-align: center; padding: 60px 20px; color: #adb5bd; }
.empty-state i { font-size: 3rem; margin-bottom: 15px; }

/* Select2 Overrides */
.select2-container--bootstrap-5 .select2-selection { border-radius: 0.375rem; }
.select2-container--bootstrap-5 .select2-dropdown { z-index: 1060; border-radius: 0.375rem; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.select2-container--bootstrap-5 .select2-results__option--highlighted { background-color: var(--accent-color); }
.select2-container--bootstrap-5 .select2-search__field { font-size: 0.875rem; }

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets on touch devices */
    .sidebar .nav-link { padding: 12px 20px; min-height: 44px; }
    .sidebar .sub-nav .nav-link { padding: 10px 20px 10px 52px; min-height: 40px; }
    .btn { min-height: 38px; }
    .btn-sm { min-height: 32px; }
    .form-control, .form-select { font-size: 16px; /* Prevent iOS zoom */ }
    .dropdown-item { padding: 10px 16px; min-height: 44px; }
}

/* iOS Safari safe areas */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .fixed-footer { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
    .main-content { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
}

/* Prevent horizontal scroll from fixed elements */
html, body { overflow-x: hidden; max-width: 100%; }

/* Fix dropdown menus on mobile */
@media (max-width: 575.98px) {
    .dropdown-menu { max-height: 60vh; overflow-y: auto; }
    .dropdown-menu-end { right: 0 !important; left: auto !important; }
}

/* Action buttons in tables: no wrap */
.table td:last-child { white-space: nowrap; }
.table td .btn-group { white-space: nowrap; }
.table td .btn-group .btn { display: inline-flex; align-items: center; }

/* ============================================================
   TSY Form Card — birleşik yeni/düzenle form tasarımı
   Referans: demov3.takiponline.com/arizali-cihaz-ekle.html
   Kullanım: <div class="card tsy-form-card"> ... </div>
   ============================================================ */
.tsy-form-card { border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border: none; }
.tsy-form-card > .card-header {
    background: #3c8dbc; color: #fff; padding: 10px 15px; border-bottom: 0;
    display: flex; justify-content: space-between; align-items: center;
}
.tsy-form-card > .card-header .header-title { font-size: 1rem; font-weight: 600; margin: 0; }
.tsy-form-card > .card-header .header-title i { margin-right: 6px; }

/* Renk varyantları */
.tsy-form-card.tsy-green > .card-header  { background: #00a65a; }
.tsy-form-card.tsy-red > .card-header    { background: #dd4b39; }
.tsy-form-card.tsy-orange > .card-header { background: #f39c12; }
.tsy-form-card.tsy-purple > .card-header { background: #605ca8; }
.tsy-form-card.tsy-teal > .card-header   { background: #39cccc; }
.tsy-form-card.tsy-navy > .card-header   { background: #001f3f; }

.tsy-form-card > .card-body { padding: 15px; }
.tsy-form-card .form-label { font-size: .78rem; font-weight: 600; color: #495057; margin-bottom: 3px; }

/* input-group kayma önleme */
.tsy-form-card .input-group { flex-wrap: nowrap; }
.tsy-form-card .input-group > .form-control,
.tsy-form-card .input-group > .form-select { min-width: 0; }
.tsy-form-card .input-group-text {
    background: #f4f6f9; color: #6c757d; border-color: #ced4da;
    min-width: 34px; padding: .35rem .5rem; justify-content: center;
    font-size: .85rem; flex-shrink: 0;
}
.tsy-form-card .form-control, .tsy-form-card .form-select { font-size: .85rem; }

/* Bölüm başlıkları */
.tsy-form-card .form-section-title {
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: #3c8dbc; padding-bottom: 4px;
    border-bottom: 2px solid #e8edf0; margin: 12px 0 10px;
}
.tsy-form-card .form-section-title:first-child { margin-top: 0; }
.tsy-form-card .form-section-title i { margin-right: 5px; }
.tsy-form-card.tsy-green  .form-section-title { color: #00a65a; }
.tsy-form-card.tsy-red    .form-section-title { color: #dd4b39; }
.tsy-form-card.tsy-orange .form-section-title { color: #f39c12; }
.tsy-form-card.tsy-purple .form-section-title { color: #605ca8; }

.tsy-form-card .hint-label { font-size: 10px; color: #d58512; margin-left: 4px; font-weight: 500; }

/* Checkbox konteyneri (input-group görünümünde) */
.tsy-form-card .tsy-check-box {
    display: flex; align-items: center; height: calc(1.5em + .75rem + 2px);
    background: #f4f6f9; border: 1px solid #ced4da; border-radius: .375rem;
    padding: .35rem .75rem; font-size: .85rem;
}
.tsy-form-card .tsy-check-box .form-check-input { margin-top: 0; margin-right: 8px; }
.tsy-form-card .tsy-check-box label { margin: 0; cursor: pointer; }

/* Footer */
.tsy-form-card > .tsy-form-footer {
    background: #f4f6f9; padding: 12px 15px; border-top: 1px solid #dee2e6;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 8px;
}
