/* Waldur Telemetry Dashboard - Waldur.com Style */

:root {
    --primary: #307300;
    --secondary: #174000;
    --text: #101828;
    --text-light: #475467;
    --background: #f2f4f7;
    --white: #ffffff;
    --border: #e4e7ec;
    --success: #12b76a;
    --warning: #f79009;
    --danger: #f04438;
    --shadow: rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--background);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

/* Header */
.header {
    background: var(--secondary);
    color: var(--white);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.875rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-brand img {
    height: 28px;
    width: auto;
}

.header-brand h1 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--white);
}

.header-brand a {
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-brand a:hover {
    text-decoration: none;
    opacity: 0.9;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.header-nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.header-nav a:hover {
    color: var(--white);
    text-decoration: none;
}

.btn-header {
    background: var(--primary);
    color: var(--white) !important;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-header:hover {
    background: #3d8f00;
    text-decoration: none;
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Stats Section */
.stats-section {
    text-align: center;
    margin-bottom: 0.5rem;
}

.stats-note {
    color: var(--text-light);
    font-size: 0.875rem;
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px var(--shadow);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px var(--shadow);
}

/* Standalone chart cards (outside grid) need bottom margin */
main > .chart-card {
    margin-bottom: 1.5rem;
}

.chart-card.full-width {
    grid-column: span 2;
}

@media (max-width: 1024px) {
    .chart-card.full-width {
        grid-column: span 1;
    }
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--text);
}

.chart-container {
    position: relative;
    height: 300px;
}

.chart-container.map {
    height: 400px;
}

/* Map */
#map {
    height: 100%;
    width: 100%;
    border-radius: 8px;
    z-index: 1;
}

/* Tables */
.table-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px var(--shadow);
    margin-bottom: 2rem;
}

.table-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    width: 250px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--secondary);
}

.btn-secondary {
    background: var(--white);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--background);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text);
    background: var(--background);
    cursor: pointer;
    user-select: none;
    font-size: 0.875rem;
}

th:hover {
    background: var(--border);
}

tr:hover {
    background: var(--background);
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: rgba(48, 115, 0, 0.05);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.25rem;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.modal-close:hover {
    color: var(--danger);
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Footer */
.footer {
    background: var(--secondary);
    color: rgba(255, 255, 255, 0.85);
    margin-top: 2rem;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-credits {
    font-size: 0.875rem;
}

.footer-credits a {
    color: var(--white);
    font-weight: 500;
}

.footer-credits a:hover {
    text-decoration: underline;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.875rem;
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--white);
    text-decoration: underline;
}

/* Version badge */
.version-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--background);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner {
        padding: 0.75rem 1rem;
    }

    .header-nav {
        display: none;
    }

    .container {
        padding: 1rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem 1rem;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        width: 100%;
    }
}
