/* public/css/style.css */
:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    color: var(--accent);
    margin-bottom: 3rem;
    justify-content: space-between;
}

.logo-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    padding: 10px;
}

.logo-img {
    width: 100%;
    max-width: 250px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.4));
    transition: transform 0.3s ease;
}

.logo-img:hover {
    transform: scale(1.02);
    filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.6));
}

.logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.logo-main {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    background: linear-gradient(135deg, #3b82f6, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
    letter-spacing: 2px;
}

.logo-sub {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    /* Boyut hiyerarşisi korundu */
    font-weight: 700;
    /* Kalınlık eşitlendi */
    line-height: 1.2;
    background: linear-gradient(135deg, #3b82f6, #10b981);
    /* Aynı gradient */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
    /* Aynı parlama */
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 5px;
    opacity: 1;
    /* Opaklık tam */
}

#menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: 0.2s;
}

.nav-item:hover,
.nav-item.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}

.connection-status {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--danger);
    transition: 0.3s;
}

.connected .status-indicator {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    padding: 2rem;
    overflow-y: auto;
    position: relative;
}

/* View Switching */
.view {
    display: none;
    height: 100%;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.device-selector select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 6px;
    outline: none;
}

.time-display {
    font-weight: 600;
    font-family: monospace;
    font-size: 1.2rem;
}

/* Cards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-card .value small {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.stat-icon {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    opacity: 0.2;
}

/* Renk Kodları */
.stat-card.critical {
    border-left: 4px solid var(--accent);
}

.stat-card.warning {
    border-left: 4px solid var(--warning);
}

.stat-card.danger {
    border-left: 4px solid var(--danger);
}

.stat-card.info {
    border-left: 4px solid var(--success);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    margin-top: 1rem;
}

.progress-bar .fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.5s ease;
}

/* Dashboard Split Layout */
.dashboard-split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    min-height: 400px;
    /* Sabit yerine minimum yükseklik */
}

.card {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.card.full-height {
    height: 100%;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-body {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.card-body.scrollable {
    overflow-y: auto;
    padding: 1rem;
}

/* Harita */
#main-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Map Header with Recenter Button */
.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-recenter {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.btn-recenter:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-recenter.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* Tablo */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table td:first-child {
    color: var(--text-secondary);
}

.data-table td:last-child {
    text-align: right;
    font-weight: 600;
    font-family: monospace;
    font-size: 1.1rem;
}

/* Charts View */
.charts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 1.5rem;
}

.chart-wrapper {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    height: 300px;
}

/* Full Map */
#full-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* History Table */
.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.history-table th {
    background-color: var(--bg-dark);
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
}

.history-table tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.btn-refresh {
    float: right;
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}

.btn-refresh:hover {
    filter: brightness(1.1);
}

.btn-back,
.btn-csv {
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}

.btn-csv {
    background: var(--success);
    border: none;
}

/* Session Grid */
.session-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.session-card {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
}

.session-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.session-card h4 {
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.session-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.chart-wrapper h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Stopwatch */
.stopwatch-card {
    margin-top: 1.5rem;
    clear: both;
    width: 100%;
}

.stopwatch-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

.stopwatch-display {
    font-family: 'Orbitron', monospace;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
    margin-bottom: 1rem;
    letter-spacing: 2px;
}

.stopwatch-display .ms {
    font-size: 1.2rem;
    opacity: 0.7;
}

.stopwatch-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.sw-btn {
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s ease;
    /* Daha hızlı tepki */
    min-width: 44px;
    user-select: none;
    /* Tıklama sırasında seçim engellenir */
    -webkit-tap-highlight-color: transparent;
    /* Mobilde highlight kaldır */
}

.sw-btn:active {
    transform: scale(0.95);
    /* Anında görsel geri bildirim */
}

.sw-btn.start {
    background: var(--success);
    color: white;
}

.sw-btn.stop {
    background: var(--warning);
    color: #1f2937;
}

.sw-btn.stop.disabled {
    background: #4b5563;
    color: #9ca3af;
    cursor: default;
}

.sw-btn.lap {
    background: var(--accent);
    color: white;
}

.sw-btn.reset {
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.sw-btn:not(.disabled):hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Lap List */
.lap-list {
    width: 100%;
    max-height: 150px;
    overflow-y: auto;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.lap-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.lap-item:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.lap-item .lap-num {
    font-weight: 600;
    color: var(--accent);
}

@media (max-width: 768px) {
    .stopwatch-display {
        font-size: 1.8rem;
    }

    .sw-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-split {
        grid-template-columns: 1fr;
        height: auto;
    }

    #main-map {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
    }

    .logo-area {
        margin-bottom: 0;
        width: 100%;
    }

    #menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        margin-top: 1rem;
        width: 100%;
    }

    .nav-menu.active {
        display: flex;
    }

    .connection-status {
        display: none;
        /* Mobilde yerden tasarruf */
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        /* Mobilde 2 kolon */
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-card .value {
        font-size: 1.5rem;
    }
}