* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ---------- Header ---------- */
.header {
    background: white;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-top: 4px solid #386a25;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

.header p {
    color: #666;
    margin-bottom: 5px;
}

.header-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.header-stat {
    text-align: center;
}

.header-stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #386a25;
}

.header-stat-label {
    color: #666;
    font-size: 14px;
    margin-top: 5px;
}

/* ---------- View Container ---------- */
.view-container {
    min-height: 400px;
}

/* ---------- Stations Grid ---------- */
.stations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.station-card-link {
    text-decoration: none !important;
    color: inherit !important;
    display: block;
}

.station-card-link:hover,
.station-card-link:visited,
.station-card-link:active {
    text-decoration: none !important;
    color: inherit !important;
}

.station-card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #e0e0e0;
}

.station-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left-color: #386a25;
}

.station-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.station-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 12px 8px;
    background: #f8f8f8;
    border-radius: 6px;
}

.stat-number {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.active-stat .stat-number {
    color: #386a25;
}

.available-stat .stat-number {
    color: #999;
}

.station-status {
    display: flex;
    justify-content: center;
    margin-top: 15px;
}

.status-indicator {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: #386a25;
    color: white;
}

.status-partial {
    background: #666;
    color: white;
}

.status-available {
    background: #999;
    color: white;
}

/* ---------- Piles Detail View ---------- */
.piles-view {
    display: none;
}

.piles-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-top: 4px solid #386a25;
}

.piles-header h2 {
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.back-button {
    background: #386a25;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.back-button:hover {
    background: #2d5a1f;
}

.piles-table,
.connectors-table {
    background: white;
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.piles-table table,
.connectors-table table {
    width: 100%;
    border-collapse: collapse;
}

.piles-table th,
.connectors-table th {
    background: #386a25;
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.piles-table td,
.connectors-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
}

.piles-table tr:hover,
.connectors-table tr:hover {
    background: #f8f8f8;
}

.piles-table tr:last-child td,
.connectors-table tr:last-child td {
    border-bottom: none;
}

.pile-active,
.connector-active {
    background: rgba(56, 106, 37, 0.05) !important;
    border-left: 4px solid #386a25;
}

.pile-active:hover,
.connector-active:hover {
    background: rgba(56, 106, 37, 0.08) !important;
}

.pile-status-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-charging {
    background: #386a25;
    color: white;
}

.badge-available {
    background: #999;
    color: white;
}

.badge-complete {
    background: #666;
    color: white;
}

.badge-active {
    background: #3498db;
    color: white;
}

.charging-info {
    font-weight: 600;
    color: #386a25;
}

.timestamp {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #666;
}

.refresh-info {
    text-align: center;
    color: #666;
    margin-top: 30px;
    font-size: 14px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ---------- Connectors Table ---------- */
.connectors-table::after {
    content: "← Scroll to see all columns →";
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 11px;
    color: #999;
    pointer-events: none;
}

@media (min-width: 1400px) {
    .connectors-table::after {
        display: none;
    }
}

/* ---------- Mobile Card Layout ---------- */
.connector-card {
    display: none;
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #e0e0e0;
}

.connector-card.active {
    border-left-color: #386a25;
    background: rgba(56, 106, 37, 0.05);
}

.connector-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.connector-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.connector-card-status {
    margin-bottom: 15px;
}

.connector-card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.connector-detail-item {
    display: flex;
    flex-direction: column;
}

.connector-detail-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.connector-detail-value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.connector-detail-value.active {
    color: #386a25;
    font-weight: 600;
}

.connector-detail-value.timestamp {
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 15px;
    }

    .header-stats {
        gap: 30px;
    }

    .piles-table table,
    .connectors-table table {
        min-width: 1000px;
    }

    .piles-table th,
    .piles-table td {
        padding: 12px 8px;
        font-size: 13px;
    }
}

@media (max-width: 1024px) {
    .header {
        padding: 25px 20px;
    }

    .header h1 {
        font-size: 26px;
    }

    .header-stats {
        gap: 25px;
        margin-top: 20px;
    }

    .header-stat-number {
        font-size: 22px;
    }

    .piles-header {
        padding: 18px;
    }

    .piles-header h2 {
        font-size: 18px;
    }

    .back-button {
        padding: 8px 16px;
        font-size: 13px;
    }

    .piles-table table,
    .connectors-table table {
        min-width: 900px;
    }

    .piles-table th,
    .piles-table td {
        padding: 10px 6px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .container {
        padding: 0;
    }

    .header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    .header h1 {
        font-size: 24px;
        margin-bottom: 10px;
    }

    .header p {
        font-size: 14px;
    }

    .header-stats {
        gap: 20px;
        margin-top: 20px;
    }

    .header-stat-number {
        font-size: 20px;
    }

    .header-stat-label {
        font-size: 13px;
    }

    .stations-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .station-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .piles-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }

    .back-button {
        width: 100%;
        text-align: center;
    }

    .piles-table table {
        display: none;
    }

    .connector-card {
        display: block;
    }

    .piles-table {
        background: transparent;
        box-shadow: none;
        overflow: visible;
    }

    .logo-responsive {
        width: 250px !important;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 15px;
    }

    .header h1 {
        font-size: 22px;
        word-break: break-word;
    }

    .header p {
        font-size: 13px;
    }

    .header-stats {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }

    .header-stat {
        min-width: 120px;
    }

    .piles-header {
        padding: 12px;
    }

    .piles-header h2 {
        font-size: 16px;
    }

    .back-button {
        padding: 10px 15px;
        font-size: 14px;
    }

    .connector-card {
        padding: 15px;
        margin-bottom: 12px;
    }

    .connector-card-title {
        font-size: 16px;
    }

    .connector-card-details {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .pile-status-badge {
        font-size: 10px;
        padding: 6px 12px;
    }

    .connector-detail-label {
        font-size: 11px;
    }

    .connector-detail-value {
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .header h1 {
        font-size: 20px;
    }

    .header-stat-number {
        font-size: 18px;
    }

    .connector-card {
        padding: 12px;
    }

    .connector-card-title {
        font-size: 15px;
    }

    .back-button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .header-stats {
        flex-direction: row;
        gap: 15px;
    }

    .connector-card-details {
        grid-template-columns: 1fr 1fr;
    }
}
