:root {
    --primary-blue: #1c326b;
    --bg-gray: #e8ebef;
    --card-bg: #ffffff;
    --sidebar-bg: #0d1b3e;
    --text-main: #333333;
    --text-muted: #666666;
    --success-green: #68b65a;
    --warning-orange: #f4a261;
    --danger-red: #e76f51;
    --radius: 8px;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-gray);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 60px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    margin-bottom: 30px;
}

.nav-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 15px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
}

.nav-item.active {
    background-color: white;
    color: var(--primary-blue);
}

.nav-item:hover:not(.active) {
    background-color: rgba(255,255,255,0.1);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    margin-left: 60px;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background-color: var(--primary-blue);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    color: white;
    position: relative;
}

.tvs-logo-container {
    background: #ccc; /* Placeholder for that metallic look */
    background: linear-gradient(135deg, #eee 0%, #aaa 100%);
    padding: 4px 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-style: italic;
    font-size: 24px;
    color: var(--primary-blue);
}

.tvs-horse {
    color: #e31e24;
}

.lablink-brand {
    position: absolute;
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-size: 10px;
}

.lablink-brand svg {
    margin-bottom: 2px;
}

/* Dashboard Content */
.dashboard {
    padding: 20px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Top Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.stat-card.projects { background: linear-gradient(90deg, #1c326b 0%, #3457a8 100%); }
.stat-card.rigs { background: linear-gradient(90deg, #68b65a 0%, #88c87c 100%); }
.stat-card.alerts { background: linear-gradient(90deg, #f4a261 0%, #fbbf8c 100%); }

.stat-icon {
    margin-right: 15px;
    opacity: 0.8;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 14px;
    font-weight: 600;
}

.stat-value-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 5px;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
}

.stat-subtext {
    font-size: 10px;
    text-align: right;
    opacity: 0.9;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.filter-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.filter-pills {
    display: flex;
    gap: 10px;
}

.pill {
    padding: 5px 15px;
    border-radius: 20px;
    background: #ddd;
    font-size: 12px;
    cursor: pointer;
    border: none;
    color: #666;
}

.pill.active {
    background: #1c326b;
    color: white;
}

/* Rig Type Columns */
.rig-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    .rig-columns {
        gap: 10px;
    }
    .stat-number {
        font-size: 24px;
    }
}

/* Tablet Optimizations (Galaxy Tab S7 FE Landscape 2560x1600 or roughly 1280x800 viewport) */
@media (max-height: 800px) {
    .dashboard {
        padding: 10px;
    }
    .stats-grid {
        margin-bottom: 15px;
    }
    .rig-column {
        min-height: 300px;
        padding: 10px;
    }
    .column-header {
        margin-bottom: 10px;
    }
}

.rig-column {
    background: #f8f9fa;
    border-radius: var(--radius);
    border: 1px solid #ddd;
    padding: 15px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.column-header img {
    height: 40px;
    border-radius: 4px;
}

.column-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
}

.column-count {
    font-size: 12px;
    color: #999;
}

/* Individual Rig Cards */
.rig-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    margin-bottom: 15px;
}

.rig-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-left: 4px solid #ddd;
    transition: transform 0.2s, box-shadow 0.2s;
}

.rig-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.rig-card.running { border-left-color: var(--success-green); }
.rig-card.stopped { border-left-color: var(--danger-red); }
.rig-card.idle { border-left-color: var(--warning-orange); }
.rig-card.not-comm { border-left-color: #999; }

.rig-card-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.rig-status-text {
    font-size: 11px;
}

.status-running { color: var(--success-green); }
.status-stopped { color: var(--danger-red); }
.status-idle { color: var(--warning-orange); }
.status-not-comm { color: var(--primary-blue); }

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

.progress-bar-container {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    margin-bottom: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-blue);
}

.rig-id {
    font-size: 10px;
    color: #bbb;
    text-transform: uppercase;
}

/* Detail Page Layout */
.detail-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    padding: 20px;
}

@media (max-width: 1024px) {
    .detail-grid {
        grid-template-columns: 180px 1fr;
        gap: 15px;
        padding: 15px;
    }
    .top-metrics-row {
        gap: 10px;
    }
    .progress-section {
        gap: 10px;
    }
}

.side-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group {
    background: white;
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
}

.control-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--primary-blue);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-control {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border: none;
    border-radius: 4px;
    background: #b0b0b0;
    color: white;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    text-transform: uppercase;
}

.btn-control.active {
    background: var(--primary-blue);
}

.info-item {
    margin-bottom: 8px;
}

.info-label {
    font-size: 10px;
    color: #888;
}

.info-value {
    font-size: 11px;
    font-weight: 600;
}

/* Detail Main Panels */
.detail-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Tablet Optimizations for Detail Page */
@media (max-height: 800px) {
    .detail-grid {
        gap: 10px;
        padding: 10px;
    }
    .detail-main {
        gap: 10px;
    }
    .metric-panel {
        padding: 10px;
    }
    .chart-panel {
        padding: 15px;
        min-height: 300px;
    }
    .placeholder-chart {
        height: 200px;
    }
    .btn-control {
        padding: 8px;
        font-size: 10px;
    }
}

.top-metrics-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.metric-panel {
    background: white;
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel-title {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 12px;
}

.status-badge-large {
    background: #ffe5e5;
    color: #d9534f;
    padding: 8px;
    text-align: center;
    border-radius: 4px;
    font-weight: bold;
}

.metric-values {
    display: flex;
    justify-content: space-between;
}

.metric-data {
    display: flex;
    flex-direction: column;
}

.progress-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.chart-panel {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-height: 400px;
    position: relative;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-date-filter {
    border: 1px solid #ddd;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.placeholder-chart {
    width: 100%;
    height: 300px;
    background-image: linear-gradient(to right, #f0f0f0 1px, transparent 1px), linear-gradient(to bottom, #f0f0f0 1px, transparent 1px);
    background-size: 40px 40px;
    position: relative;
}

.chart-line {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.footer-info {
    position: fixed;
    bottom: 5px;
    right: 10px;
    font-size: 10px;
    color: #999;
}
