﻿:root {
    --sidebar-width: 260px;
    --primary: #1a1a2e;
    --secondary: #16213e;
    --accent: #0f3460;
    --highlight: #e94560;
    --green: #2ecc71;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #333;
    --text-light: #666;
    --danger: #e74c3c;
    --warning: #f39c12;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* ===== САЙДБАР ===== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
}
.logo {
    padding: 1.5rem;
    font-size: 1.4rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.logo-icon { font-size: 1.8rem; }
.side-nav {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    background: transparent;
    color: rgba(255,255,255,0.8);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    text-align: left;
    transition: all 0.2s;
    width: 100%;
}
.nav-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}
.nav-btn.active {
    background: var(--highlight);
    color: white;
    font-weight: 600;
}
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Виджет кошелька */
#wallet-widget button {
    width: 100%;
    padding: 0.7rem;
    background: var(--green);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}
#wallet-widget button:hover { background: #27ae60; }
.wallet-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.wallet-info .address {
    background: rgba(255,255,255,0.15);
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    text-align: center;
    word-break: break-all;
}
.wallet-info .disconnect-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

/* ===== ОСНОВНОЙ КОНТЕНТ ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem;
    min-height: 100vh;
}
.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin-bottom: 1rem; }

/* Фильтры */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}
.filter-buttons { display: flex; gap: 0.5rem; }
.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.filter-btn.active {
    background: var(--highlight);
    color: white;
    border-color: var(--highlight);
}
.search-input {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    width: 250px;
    outline: none;
}
.search-input:focus { border-color: var(--accent); }

/* Сетка автомобилей */
.car-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}
.car-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.car-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
.car-card-image {
    height: 160px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
}
.car-card-body { padding: 1rem; }
.car-card-body h3 { margin-bottom: 0.3rem; }
.car-card-body .car-class {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.class-econom { background: #e8f5e9; color: #2e7d32; }
.class-comfort { background: #e3f2fd; color: #1565c0; }
.class-business { background: #fff3e0; color: #e65100; }
.car-card-body .car-location { color: var(--text-light); font-size: 0.85rem; }
.car-card-body .car-status {
    margin-top: 0.8rem;
    font-weight: 600;
}
.status-available { color: var(--green); }
.status-rented { color: var(--danger); }
.car-card-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0 1rem 1rem;
}
.car-card-footer button {
    flex: 1;
    padding: 0.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-rent {
    background: var(--highlight);
    color: white;
}
.btn-rent:hover { background: #c0392b; }
.btn-rent:disabled { background: #ccc; cursor: not-allowed; }
.btn-passport {
    background: var(--accent);
    color: white;
}
.btn-passport:hover { background: #1a252f; }

/* ===== ТАБЛИЦЫ ===== */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 1.5rem;
}
.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.history-table th, .history-table td {
    text-align: left;
    padding: 0.8rem;
    border-bottom: 1px solid #eee;
}
.history-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text-light);
}
.history-table tr:hover { background: #fafafa; }

/* ===== КАРТОЧКИ ДЛЯ ПРОФИЛЯ И ВЛАДЕЛЬЦА ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.info-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 1.5rem;
}
.info-card h3 {
    color: var(--text-light);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}
.info-card .value {
    font-size: 2rem;
    font-weight: bold;
}
.info-card .sub {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

/* Репутация */
.reputation-section { margin-bottom: 2rem; }
.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--green) var(--score-percent), #eee var(--score-percent));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem auto;
    position: relative;
}
.score-inner {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}
.chart-placeholder {
    height: 200px;
    background: #f8f9fa;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    margin-top: 1rem;
}

/* Активная поездка */
.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.telemetry-card {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.telemetry-card .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 0.3rem;
}
.telemetry-card .val {
    font-size: 1.8rem;
    font-weight: bold;
}
.telemetry-card.warning .val { color: var(--warning); }
.telemetry-card.danger .val { color: var(--danger); }

.log-container {
    background: #1a1a2e;
    color: #0f0;
    font-family: 'Courier New', monospace;
    padding: 1rem;
    border-radius: 10px;
    height: 200px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.map-placeholder {
    height: 300px;
    background: linear-gradient(135deg, #dfe6e9 0%, #b2bec3 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

/* ===== МОДАЛЬНЫЕ ОКНА ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-wide { max-width: 600px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}
.modal-car-details {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.modal-car-image {
    width: 120px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
}
.modal-rent-info p { margin: 0.5rem 0; }
.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}
.btn-primary {
    padding: 0.7rem 1.5rem;
    background: var(--highlight);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
}
.btn-secondary {
    padding: 0.7rem 1.5rem;
    background: #ddd;
    color: var(--text);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}
.btn-danger {
    padding: 0.7rem 1.5rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.error {
    color: var(--danger);
    font-weight: bold;
    margin-top: 0.8rem;
}

/* Паспорт автомобиля */
.passport-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}
.passport-item {
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 8px;
}
.passport-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
}
.passport-item .val {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.2rem;
}
.blockchain-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-top: 0.8rem;
}

/* Адаптив */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.5rem;
    }
    .main-content { margin-left: 0; padding: 1rem; }
    .car-grid { grid-template-columns: 1fr; }
    .cards-grid { grid-template-columns: 1fr; }
    .telemetry-grid { grid-template-columns: 1fr 1fr; }
}