
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    padding: 20px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Galvenā struktūra */
.main-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
}

/* Sidebar */
.sidebar {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    height: fit-content;
}

.sidebar h2 {
    color: #2a5298;
    margin-bottom: 15px;
    font-size: 1.3em;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.object-list {
    list-style: none;
    margin-bottom: 20px;
}

.object-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.object-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.object-item.active {
    background: #2a5298;
    color: white;
    border-left-color: #ffd700;
}

.object-id {
    font-weight: bold;
    font-size: 0.85em;
    opacity: 0.7;
}

.object-name {
    font-size: 0.95em;
    margin-top: 3px;
}

.actions {
    border-top: 2px solid #eee;
    padding-top: 15px;
}

/* Pogas */
.btn {
    display: block;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
    margin-bottom: 10px;
    font-weight: 600;
}

.btn-primary {
    background: #2a5298;
    color: white;
}

.btn-primary:hover {
    background: #1e3c72;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(42,82,152,0.3);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

/* Galvenais saturs */
.content {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    min-height: 600px;
}

/* Tabi */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 25px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-weight: 500;
}

.tab-btn:hover {
    color: #2a5298;
}

.tab-btn.active {
    color: #2a5298;
    border-bottom-color: #2a5298;
    font-weight: 600;
}

/* Tabu saturs */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

h3 {
    color: #2a5298;
    margin-bottom: 20px;
    font-size: 1.4em;
}

.placeholder {
    color: #999;
    text-align: center;
    padding: 40px;
    font-style: italic;
}

/* Laika līnija */
.timeline-wrapper {
    overflow-x: auto;
    margin-bottom: 20px;
}

.timeline {
    min-width: 600px;
}

.timeline-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    height: 45px;
}

.signal-label {
    width: 80px;
    font-weight: bold;
    font-size: 0.9em;
    color: #555;
    flex-shrink: 0;
}

.timeline-track {
    flex: 1;
    height: 35px;
    background: #f0f0f0;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    border: 1px solid #ddd;
}

.signal-block {
    position: absolute;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    border-radius: 3px;
}

.signal-block.type-v { background: #28a745; }
.signal-block.type-a { background: #ffc107; color: #333; text-shadow: none; }
.signal-block.type-p { background: #17a2b8; }

.time-axis {
    display: flex;
    margin-left: 80px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 2px solid #ddd;
    font-size: 0.8em;
    color: #666;
}

.time-marker {
    flex: 1;
    text-align: center;
    position: relative;
}

.time-marker::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    width: 1px;
    height: 6px;
    background: #999;
}

/* Leģenda */
.legend {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

.color-box.green { background: #28a745; }
.color-box.yellow { background: #ffc107; }
.color-box.blue { background: #17a2b8; }
.color-box.red { background: #dc3545; }

/* Datu tabula */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background: #2a5298;
    color: white;
    font-weight: 600;
}

.data-table tr:hover {
    background: #f5f5f5;
}

/* Statistika */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.85em;
    opacity: 0.9;
}

/* Rediģēšanas forma */
.edit-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2a5298;
}

.signal-edit-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #2a5298;
}

.signal-edit-card h4 {
    margin-bottom: 15px;
    color: #2a5298;
}

/* Koda bloks */
.code-block {
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 500px;
    overflow-y: auto;
}

/* Responsivitāte */
@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 0.85em;
    }
}

/* Ielādes indikators */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2a5298;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Kļūdu paziņojumi */
.error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px solid #f5c6cb;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px solid #c3e6cb;
}