﻿/* DataRapor Core - Site CSS */

/* Global Settings - NO SCROLL BAR */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden; /* Scroll bar'ı kaldırır */
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --top-menu-height: 56px;
    --left-menu-width: 250px;
}

/* Top Menu - Fixed at top */
.top-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--top-menu-height);
    z-index: 1030;
    background-color: var(--dark-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Left Menu Panel - Fixed on left side */
.left-menu-panel {
    position: fixed;
    left: 0;
    top: var(--top-menu-height);
    width: var(--left-menu-width);
    height: calc(100vh - var(--top-menu-height));
    background-color: white;
    border-right: 2px solid #dee2e6;
    overflow: hidden;
    transition: transform 0.3s ease-in-out;
    z-index: 1020;
    transform: translateX(0);
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.left-menu-panel.collapsed {
    transform: translateX(-100%);
}

/* Main Content Area - Takes remaining space - NO SCROLL */
.main-content-area {
    position: fixed;
    left: var(--left-menu-width);
    top: var(--top-menu-height);
    width: calc(100% - var(--left-menu-width));
    height: calc(100vh - var(--top-menu-height));
    overflow: hidden; /* Scroll bar'ı kaldırır */
    transition: all 0.3s ease-in-out;
    background-color: #fff;
}

.main-content-area.expanded {
    left: 0;
    width: 100%;
}

/* Animations */
@-webkit-keyframes blinker {
    from { opacity: 1; }
    to { opacity: 0; }
}

.blink {
    text-decoration: blink;
    -webkit-animation-name: blinker;
    -webkit-animation-duration: 0.6s;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-timing-function: ease-in-out;
    -webkit-animation-direction: alternate;
}

/* Utilities */
.vcenter {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Buttons */
.btn {
    border-radius: 4px;
    padding: 8px 16px;
}

/* Cards */
.card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: none;
    margin-bottom: 20px;
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* DataTables */
.dataTables_wrapper {
    padding: 10px;
}

table.dataTable thead th {
    background-color: var(--primary-color);
    color: white;
}

/* Chart */
.chart-container {
    position: relative;
    height: 400px;
    margin: 20px 0;
}

/* Visual */
#visualContainer {
    position: relative;
    min-height: 600px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    overflow: auto;
}

#visualContainer .tag-value {
    font-weight: bold;
    color: var(--primary-color);
}

/* Tag Quality Warning */
.tag-quality-warning {
    opacity: 0.6;
    border: 1px solid var(--warning-color) !important;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Footer */
.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    white-space: nowrap;
    line-height: 60px;
}

/* Tank Progress Bar (SCADA Tank Levelleri) */
.tank-progress-container {
    position: relative;
    overflow: hidden;
    border: 1px solid #000;
}

.tank-progress-fill {
    position: absolute;
    bottom: 0; /* AŞAĞIDAN BAŞLA - kritik! */
    left: 0;
    width: 100%;
    height: 0%; /* Başlangıç yüksekliği */
    background: #2196F3;
    transition: height 0.3s ease, background-color 0.3s ease;
}

.tank-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    z-index: 10;
    pointer-events: none;
}

.tank-progress-label {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    color: #000;
    font-size: 10px;
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .left-menu-panel {
        transform: translateX(-100%);
        z-index: 1050; /* Mobilde daha üstte */
    }
    
    .left-menu-panel.show {
        transform: translateX(0);
    }
    
    .main-content-area {
        margin-left: 0;
        width: 100%;
        left: 0 !important;
    }
    
    /* DataTable - Mobilde Tag Name ve Last Update sütunlarını gizle */
    #dataTable thead th:nth-child(1),
    #dataTable tbody td:nth-child(1),
    #dataTable thead th:nth-child(5),
    #dataTable tbody td:nth-child(5) {
        display: none !important;
    }
    
    /* Tree container mobilde scroll */
    #deviceTree {
        overflow-y: auto;
        max-height: calc(100vh - var(--top-menu-height) - 48px);
    }
    
    /* Mobilde Visual, Chart, Endex sekmelerini gizle */
    #visual-tab,
    #visual,
    #chart-tab,
    #chart,
    #endex-tab,
    #endex {
        display: none !important;
    }
    
    /* DataTable length menu dropdown ok simgesini düzelt */
    .dataTables_length select {
        padding-right: 30px !important;
        background-position: right 8px center !important;
    }
}

/* ============================================ */
/* Tile/Table View Styles */
/* ============================================ */

/* Toggle Buttons */
.view-toggle-container {
    position: relative;
    z-index: 100;
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    flex-shrink: 0;
}

.view-toggle-container .btn {
    min-width: 100px;
    transition: all 0.2s ease;
}

.view-toggle-container .btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Tile Container */
.tile-container {
    position: relative;
    padding: 20px;
    z-index: 1;
}

.tile-section {
    margin-bottom: 30px;
}

.tile-section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.tile-section-title i {
    margin-right: 8px;
    color: var(--primary-color);
}

/* Tile Grid */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

/* Individual Tile Card */
.tile-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.tile-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.tile-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

.tile-card-name {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95rem;
}

.tile-card-tag {
    font-size: 0.75rem;
    color: var(--secondary-color);
    background-color: #f8f9fa;
    padding: 2px 8px;
    border-radius: 4px;
}

.tile-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tile-card-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.tile-card-unit {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--secondary-color);
}

.tile-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #e9ecef;
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.tile-card-timestamp {
    display: flex;
    align-items: center;
    gap: 5px;
}

.tile-card-timestamp i {
    font-size: 0.75rem;
}

/* Boolean Tile Specific Styles */
.tile-card.boolean-tile {
    border-left: 4px solid var(--secondary-color);
}

.tile-card.boolean-tile.active {
    border-left-color: var(--success-color);
}

.tile-card.boolean-tile .tile-card-value {
    justify-content: center;
    padding: 10px 0;
}

.tile-card.boolean-tile .tile-status-badge {
    font-size: 1.5rem;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
}

.tile-status-badge.active {
    background-color: var(--success-color);
    color: white;
}

.tile-status-badge.inactive {
    background-color: var(--secondary-color);
    color: white;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tile-grid {
        grid-template-columns: 1fr;
    }
    
    .tile-container {
        padding: 10px;
    }
    
    .view-toggle-container {
        padding: 10px;
    }
    
    .view-toggle-container .btn {
        flex: 1;
        min-width: auto;
    }
}
