/* ==========================================================================
   KaravanimNerede — Admin Panel Theme
   28 Eki 2026 (v3): "tema birebir motorumnerede gibi olsun" karari.

   ONCEKI YAKLASIM TERK EDILDI. v1/v2'de bu dosya kendi --kn-* token setiyle
   MN'nin temasini YENIDEN URETMEYE calisiyordu; her token ayri ayri elle
   cevrildigi icin surekli kaydi (yesil/amber paletten kalma SCADA renkleri,
   MN'de mavi/amber olan ikon renklerinin kirmiziya cekilmesi vb. — hepsi
   tek tek yakalanip duzeltilmek zorunda kaldi).

   YENI YAKLASIM: bu dosya artik MN'nin admin temasinin BIREBIR KOPYASI.
   - Bolum 2  = /www/motorumnerede/admin/styles.css           (VERBATIM)
   - Bolum 3  = /www/motorumnerede/admin/dashboard.html <style> (VERBATIM)
                (MN'de satir ici duruyor; karavan panelinde sayfalar dinamik
                 yuklendigi icin temaya alindi — DEGERLER AYNEN KORUNDU)
   - Bolum 1  = --kn-* uyumluluk katmani: karavan sayfalarinin satir ici
                style'larinda kullandigi 17 token, MN'nin GERCEK literal
                degerlerine baglandi. Yeni bir renk ICAT EDILMEDI.
   - Bolum 4  = MN'de karsiligi olmayan 3 karavan sinifi (.btn-accent,
                .badge-maintenance, .badge-rental) — MN'nin kendi badge/buton
                paletinden (ayni Flat-UI renk ailesi) secildi.

   KURAL: Bolum 2 ve 3'e DOKUNMA. MN'nin temasi degisirse o iki bolum
   yeniden kopyalanir; karavan'a ozel her sey Bolum 1 ve 4'te yasar.
   ========================================================================== */

/* ===== BOLUM 1 — --kn-* uyumluluk katmani (MN'nin literal degerleri) ===== */
:root {
    /* Marka — MN admin paneline ozgu mercan kirmizisi (styles.css:15,30,78).
       DIKKAT: MN'nin PUBLIC sitesindeki #dc2626'dan FARKLI. */
    --kn-primary: #ff6348;
    --kn-primary-rgb: 255, 99, 72;

    /* Vurgu — MN'nin butun gradient'lerinde #ff6348 ile eslesen ton
       (styles.css:164,229,301). Ayri bir "ikincil marka rengi" DEGIL. */
    --kn-accent: #ff7675;
    --kn-accent-rgb: 255, 118, 117;
    --kn-accent-dark: #c0392b;

    /* Yuzeyler / metin — MN'nin body/surface/form degerleri */
    --kn-bg: #eef0f4;          /* styles.css:6  body background */
    --kn-surface: #ffffff;     /* styles.css:12 header/sidebar/card */
    --kn-surface-alt: #e7eaf0; /* styles.css:181 .btn-secondary */
    --kn-border: #e1e5e9;      /* styles.css:282 form input border */
    --kn-text: #1f2430;        /* styles.css:8  body color */
    --kn-text-muted: #5b6472;  /* styles.css:207 .stat-label */

    /* Durum renkleri — MN styles.css:159-161 ile birebir */
    --kn-status-online: #0f766e;
    --kn-status-warning: #b45309;
    --kn-status-critical: #dc2626;

    /* SCADA — MN dashboard.html'in kendi degerleri (Bolum 3 ile ayni) */
    --kn-scada-healthy: #10b981;
    --kn-scada-error: #ef4444;
    --kn-scada-node-border: #4b5563;
}

/* ===== BOLUM 2 — MN admin/styles.css VERBATIM (DOKUNMA) ================== */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* 8 Eyl 2026: koyu degrade -> açık tema (kullanıcı isteği) */
    background: #eef0f4;
    min-height: 100vh;
    color: #1f2430;
}

.header {
    background: #ffffff; box-shadow: 0 1px 6px rgba(15,23,42,.08);
    padding: 20px 0;
    backdrop-filter: blur(10px);
    border-bottom: 2px solid #ff6348;
}

.nav-container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ff6348;
}

.main-container {
    display: flex;
    max-width: 100%;
    margin: 0 auto;
    min-height: calc(100vh - 100px);
}

.sidebar {
    position: relative;
    width: 250px;
    background: #ffffff; box-shadow: 1px 0 6px rgba(15,23,42,.06);
    backdrop-filter: blur(10px);
    border-right: 2px solid rgba(255, 99, 72, 0.3);
    padding: 20px 0;
    margin: 20px 0;
    border-radius: 15px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
}

.menu-item {
    margin-bottom: 5px;
}

.menu-button {
    width: 100%;
    background: transparent;
    border: none;
    color: #3a4150;
    padding: 15px 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-button:hover {
    background: rgba(255, 99, 72, 0.1);
    border-left: 4px solid #ff6348;
    padding-left: 16px;
}

.menu-button.active {
    background: rgba(255, 99, 72, 0.2);
    border-left: 4px solid #ff6348;
    padding-left: 16px;
    color: #ff6348;
}

.menu-icon {
    font-size: 1.1rem;
    width: 20px;
}

.content-area {
    flex: 1;
    padding: 20px;
    width: 100%;
    overflow-x: auto;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.panel-card {
    background: #ffffff; box-shadow: 0 2px 10px rgba(15,23,42,.07);
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 99, 72, 0.3);
    transition: all 0.3s;
}

.panel-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 99, 72, 0.3);
    border-color: #ff6348;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 99, 72, 0.3);
}

.card-icon {
    font-size: 2rem;
    color: #ff6348;
}

.card-title {
    font-size: 1.3rem;
    font-weight: bold;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.info-value {
    font-weight: bold;
    color: #ff6348;
}

.status-online { color: #0f766e; }
.status-warning { color: #b45309; }
.status-critical { color: #dc2626; }

.action-btn {
    background: linear-gradient(45deg, #ff6348, #ff7675);
    border: none;
    border-radius: 10px;
    padding: 10px 15px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    margin-right: 10px;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 99, 72, 0.4);
}

.btn-secondary {
    background: #e7eaf0; color: #2b3140;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: rgba(255, 99, 72, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 99, 72, 0.3);
}

.stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff6348;
}

.stat-label {
    font-size: 0.9rem;
    color: #5b6472;
    margin-top: 5px;
}

.big-stat {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ff6348;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e3e6ec;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #ff6348, #ff7675);
    border-radius: 4px;
    transition: width 0.3s;
}

.management-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    color: #333;
    margin-bottom: 20px;
    width: 100%;
    max-width: none;
}

.management-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ff6348;
}

.management-header h1 {
    color: #333;
    margin-bottom: 10px;
}

.management-header p {
    color: #666;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: #333;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ff6348;
}

.btn-primary {
    background: linear-gradient(135deg, #ff6348 0%, #ff7675 100%);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 99, 72, 0.4);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 10px;
    overflow-x: auto;
    display: block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.data-table thead,
.data-table tbody,
.data-table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
    font-size: 14px;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table th {
    background: #f8f9fa;
    color: #333;
    font-weight: 600;
    user-select: none;
}

.data-table th:hover {
    background: #e9ecef;
}

.data-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.data-table tbody tr:nth-child(odd) {
    background: white;
}

.data-table tr:hover {
    background: #e3f2fd !important;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.badge-admin { background: #ff6b6b; color: white; }
.badge-user { background: #4ecdc4; color: white; }
.badge-fleet_manager { background: #45b7d1; color: white; }
.badge-dealer { background: #96ceb4; color: white; }
.badge-available { background: #4ecdc4; color: white; }
.badge-assigned { background: #feca57; color: white; }
.badge-active { background: #6c5ce7; color: white; }
.badge-inactive { background: #a0a0a0; color: white; }

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    margin: 2px;
}

.btn-edit { background: #feca57; color: white; }
.btn-delete { background: #ff6b6b; color: white; }
.btn-assign { background: #00b894; color: white; }
.btn-view { background: #6c5ce7; color: white; }

.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    max-width: 400px;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
}

.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        position: relative;
        width: 100%;
        margin: 10px;
    }

    .sidebar-menu {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        padding: 0 10px;
    }

    .menu-item {
        margin-bottom: 0;
        min-width: 150px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .management-container {
        padding: 15px;
        overflow-x: hidden;
    }

    .data-table {
        font-size: 12px;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        margin-bottom: 15px;
        border: 1px solid #e1e5e9;
        border-radius: 8px;
        padding: 10px;
        background: white;
    }

    .data-table td {
        text-align: right;
        padding: 8px;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        padding-left: 50%;
    }

    .data-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        font-weight: bold;
        text-align: left;
        color: #333;
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .content-area {
        padding: 10px;
    }

    .nav-container {
        flex-direction: column;
        gap: 10px;
    }

    .logo {
        font-size: 1.3rem;
    }
}

/* ===== BOLUM 3 — MN admin/dashboard.html <style> VERBATIM (DOKUNMA) ======
   MN'de bu bloklar dashboard.html'in icinde satir ici duruyor. Karavan
   panelinde alt sayfalar fetch ile dinamik yuklendigi icin temaya alindi;
   SECICILER VE DEGERLER AYNEN KORUNDU (tek fark: .icon-bg.rental, MN'nin
   .icon-bg.dealer'inin karavandaki adi — ayni amber degerle, asagida). */

.dashboard-container { padding: 20px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.header-actions .clock { font-family: monospace; font-size: 1.2rem; background: #ffffff; border: 1px solid #e1e5e9; color: #1f2430; padding: 5px 15px; border-radius: 5px; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: #ffffff; box-shadow: 0 2px 10px rgba(15,23,42,.07); padding: 20px; border-radius: 12px; display: flex; align-items: center; gap: 15px; transition: transform 0.2s; }
.stat-card:hover { transform: translateY(-5px); }
.icon-bg { width: 50px; height: 50px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.icon-bg.user { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.icon-bg.device { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.icon-bg.dealer { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.icon-bg.rental { background: rgba(245, 158, 11, 0.2); color: #f59e0b; } /* MN'deki .icon-bg.dealer'in karavandaki adi */
.icon-bg.db { background: rgba(139, 92, 246, 0.2); color: #8b5cf6; }
.stat-info { display: flex; flex-direction: column; }
.stat-info .label { font-size: 0.9rem; color: #6b7280; }
.stat-info .value { font-size: 1.5rem; font-weight: bold; }

/* SCADA STYLES */
.scada-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    padding: 50px;
    background: #1e1e24;
    border-radius: 15px;
    position: relative;
    min-height: 400px;
    overflow: hidden;
    align-items: center;
}

.scada-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Basit bağlantı çizgileri */
.scada-column:nth-child(-n+2):not(:last-child)::after {
    content: '';
    position: absolute;
    right: -50%;
    top: 50%;
    width: 100%;
    height: 4px;
    background: #374151;
    transform: translateY(-2px);
    z-index: 1;
}

.scada-column:nth-child(-n+2).flowing:not(:last-child)::after {
    background: #60a5fa;
    box-shadow: 0 0 10px #60a5fa;
}
.scada-header-inner { display: flex; justify-content: space-between; margin-bottom: 15px; align-items: center; }

.scada-node {
    background: #2b2b36;
    border: 2px solid #4b5563;
    border-radius: 10px;
    padding: 15px;
    width: 140px;
    text-align: center;
    color: white;
    position: relative;
    z-index: 10;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.scada-node.healthy { border-color: #10b981; box-shadow: 0 0 15px rgba(16, 185, 129, 0.3); }
.scada-node.error { border-color: #ef4444; box-shadow: 0 0 20px rgba(239, 68, 68, 0.6); animation: pulse-error 1s infinite; }

@keyframes pulse-error { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

.scada-node .icon { font-size: 2.5rem; margin-bottom: 10px; }
.scada-node .label { font-weight: bold; font-size: 0.9rem; }
.scada-node .sub-label { font-size: 0.7rem; color: #9ca3af; margin-bottom: 5px; }
.scada-node .value { font-size: 0.8rem; color: #60a5fa; font-family: monospace; }
.scada-node .status-indicator { width: 10px; height: 10px; border-radius: 50%; background: #4b5563; margin: 5px auto 0; }

.scada-link, .scada-link2 {
    height: 4px;
    background: #374151;
    flex-grow: 1;
    position: relative;
    margin: 0;
    align-self: center;
}

.flow-dots {
    position: absolute;
    top: -3px;
    left: 0;
    width: 100%;
    height: 10px;
    background-image: radial-gradient(circle, #60a5fa 3px, transparent 4px);
    background-size: 20px 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.flowing .flow-dots {
    opacity: 1;
    animation: flow-anim 1s linear infinite;
}

@keyframes flow-anim { from { background-position: 0 0; } to { background-position: 20px 0; } }

.status-badge { padding: 5px 10px; border-radius: 5px; font-size: 0.8rem; background: #4b5563; color: white; }

/* ===== BOLUM 4 — MN'de karsiligi olmayan karavan siniflari ===============
   Renkler MN'nin kendi badge/buton paletinden (ayni Flat-UI ailesi) secildi,
   yeni bir renk ailesi ICAT EDILMEDI. */

/* MN'de .btn-accent yok; karavan'in "Ata / Kaydet" butonlari kullaniyor.
   Birebir parite icin MN'nin .btn-primary'siyle AYNI gorunum verildi. */
.btn-accent {
    background: linear-gradient(135deg, #ff6348 0%, #ff7675 100%);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 99, 72, 0.4);
}

/* Karavan cihaz durumu 'maintenance' — MN'nin badge paletinden turuncu. */
.badge-maintenance { background: #e17055; color: white; }
/* Kiralama firmasi rozeti — MN'nin .btn-assign yesiliyle ayni. */
.badge-rental { background: #00b894; color: white; }
