* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.connection-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    background: #dc3545;
}

.connection-status.connected {
    background: #28a745;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Main container */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: #16213e;
    border-right: 1px solid #0f3460;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #0f3460;
}

.sidebar-header h2 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.search-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #1a1a2e;
    color: #eee;
}

.gateway-list {
    flex: 1;
    overflow-y: auto;
}

.gateway-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #0f3460;
    cursor: pointer;
    transition: background 0.2s;
}

.gateway-item:hover {
    background: #1a1a2e;
}

.gateway-item.active {
    background: #0f3460;
    border-left: 3px solid #e94560;
}

.gateway-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.gateway-mac {
    font-size: 0.75rem;
    color: #888;
    font-family: monospace;
}

.gateway-status {
    margin-top: 0.25rem;
}

.status-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.status-badge.provisioned {
    background: #28a745;
}

.status-badge.unprovisioned {
    background: #ffc107;
    color: #000;
}

.status-badge.running {
    background: #28a745;
}

.status-badge.exited {
    background: #dc3545;
}

.no-gateways {
    padding: 2rem;
    text-align: center;
    color: #666;
}

/* Main panel */
.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.no-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: #666;
}

.gateway-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #0f3460;
    background: #16213e;
}

.gateway-info h2 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.gateway-details {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: #888;
}

/* Tabs */
.tabs {
    display: flex;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
}

.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    color: #eee;
}

.tab.active {
    color: #e94560;
    border-bottom-color: #e94560;
}

.tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Terminal tab */
.terminal-tab {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

#terminal-container {
    flex: 1;
    padding: 0.5rem;
    background: #000;
}

.terminal-controls {
    padding: 0.5rem 1rem;
    background: #16213e;
    border-top: 1px solid #0f3460;
    display: flex;
    gap: 0.5rem;
}

/* Containers tab */
.containers-tab,
.files-tab,
.metrics-tab {
    flex: 1;
    overflow: auto;
    padding: 1rem;
}

.toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.current-path {
    font-family: monospace;
    flex: 1;
    background: #1a1a2e;
    padding: 0.5rem;
    border-radius: 4px;
}

/* Data table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #0f3460;
}

.data-table th {
    background: #16213e;
    font-weight: 500;
}

.data-table tr:hover {
    background: rgba(233, 69, 96, 0.1);
}

.file-icon {
    margin-right: 0.5rem;
}

/* Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.metric-card {
    background: #16213e;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
}

.metric-card h4 {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 600;
    color: #e94560;
}

.metric-detail {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.5rem;
}

/* Log viewer & File viewer */
.log-viewer,
.file-viewer {
    position: fixed;
    top: 10%;
    left: 10%;
    right: 10%;
    bottom: 10%;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.log-header,
.file-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #0f3460;
}

.log-content,
.file-content {
    flex: 1;
    overflow: auto;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #0f3460;
    color: #eee;
    transition: background 0.2s;
}

.btn:hover:not(:disabled) {
    background: #1a4d7c;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #e94560;
}

.btn-primary:hover:not(:disabled) {
    background: #ff6b6b;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
}

.btn-xs {
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #0f3460;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1a4d7c;
}
