/* New Interface Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: #0d1117;
    color: #c9d1d9;
    overflow: hidden;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    height: 60px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-left h1 {
    color: #58a6ff;
    font-size: 18px;
    font-weight: 600;
}

.status-indicators {
    display: flex;
    gap: 8px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f85149;
    transition: background-color 0.3s ease;
}

.status-dot.running {
    background: #3fb950;
}

.status-dot.warning {
    background: #d29922;
}

.header-right {
    display: flex;
    align-items: center;
}

.control-buttons {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-success {
    background: #238636;
    color: white;
}

.btn-success:hover {
    background: #2ea043;
}

.btn-danger {
    background: #da3633;
    color: white;
}

.btn-danger:hover {
    background: #f85149;
}

.btn-warning {
    background: #bf8700;
    color: white;
}

.btn-warning:hover {
    background: #d29922;
}

.btn-secondary {
    background: #6e7681;
    color: white;
}

.btn-secondary:hover {
    background: #8b949e;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 10px;
}

.btn.active {
    background: #58a6ff;
    color: white;
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - 120px);
    gap: 1px;
    background: #30363d;
}

/* Sidebars */
.sidebar {
    width: 300px;
    background: #161b22;
    border-right: 1px solid #30363d;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #30363d;
    background: #21262d;
}

.sidebar-header h3 {
    color: #58a6ff;
    font-size: 14px;
    margin-bottom: 10px;
}

.viewer-controls, .task-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input, .filter-select {
    flex: 1;
    padding: 6px 8px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 4px;
    color: #c9d1d9;
    font-size: 11px;
}

.search-input:focus, .filter-select:focus {
    outline: none;
    border-color: #58a6ff;
}

/* File Tree */
.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-size: 11px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    user-select: none;
}

.file-item:hover {
    background: #21262d;
    transform: translateX(2px);
}

.file-item.selected {
    background: #1f6feb;
    color: white;
}

.file-item.expanded {
    background: #0d1117;
    border-left: 2px solid #58a6ff;
}

.file-item.expanded:hover {
    background: #161b22;
}

.file-icon {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    color: #8b949e;
    font-size: 10px;
}

/* Center Panel */
.center-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0d1117;
    overflow: hidden;
}

/* Process Monitor */
.process-monitor {
    height: 40%;
    border-bottom: 1px solid #30363d;
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #30363d;
    background: #161b22;
}

.section-header h3 {
    color: #58a6ff;
    font-size: 14px;
}

.monitor-controls, .log-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.update-indicator {
    color: #8b949e;
    font-size: 10px;
}

.process-grid {
    flex: 1;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    overflow-y: auto;
}

.process-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s ease;
}

.process-card:hover {
    border-color: #58a6ff;
    transform: translateY(-2px);
}

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

.process-name {
    font-weight: 600;
    color: #58a6ff;
    font-size: 12px;
}

.process-status {
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
}

.process-status.running {
    background: #1a472a;
    color: #3fb950;
}

.process-status.stopped {
    background: #490202;
    color: #f85149;
}

.process-status.warning {
    background: #4d2d00;
    color: #d29922;
}

.process-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 10px;
}

.process-info-item {
    display: flex;
    justify-content: space-between;
}

.process-info-label {
    color: #8b949e;
}

.process-info-value {
    color: #c9d1d9;
    font-weight: 500;
}

/* Logs Section */
.logs-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.log-tabs {
    display: flex;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    overflow-x: auto;
}

.log-tab {
    padding: 10px 15px;
    cursor: pointer;
    border-right: 1px solid #30363d;
    font-size: 11px;
    white-space: nowrap;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.log-tab:hover {
    background: #21262d;
}

.log-tab.active {
    background: #1f6feb;
    color: white;
}

.log-tab-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f85149;
}

.log-tab-status.running {
    background: #3fb950;
}

.log-tab.service-tab {
    background: #21262d;
    border-bottom: 2px solid transparent;
}

.log-tab.service-tab:hover {
    background: #30363d;
    border-bottom-color: #58a6ff;
}

.log-tab.service-tab.active {
    background: #1f6feb;
    border-bottom-color: #ffffff;
}

/* Log Sub-Tabs */
.log-sub-tabs {
    background: #0d1117;
    border-bottom: 1px solid #30363d;
    padding: 10px 15px;
}

.sub-tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.sub-tab-title {
    color: #58a6ff;
    font-size: 12px;
    font-weight: 600;
}

.sub-tab-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sub-tab-btn {
    padding: 6px 12px;
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sub-tab-btn:hover {
    background: #30363d;
    border-color: #58a6ff;
    color: #58a6ff;
}

.sub-tab-btn.active {
    background: #1f6feb;
    border-color: #1f6feb;
    color: white;
}

.log-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #0d1117;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px;
    line-height: 1.4;
}

.log-line {
    margin-bottom: 2px;
    word-wrap: break-word;
}

.log-line.error {
    color: #f85149;
}

.log-line.warning {
    color: #d29922;
}

.log-line.info {
    color: #58a6ff;
}

.log-line.success {
    color: #3fb950;
}

.no-logs {
    color: #8b949e;
    text-align: center;
    padding: 40px;
    font-style: italic;
}

/* Task Monitor */
.task-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.task-item {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.task-item:hover {
    border-color: #58a6ff;
}

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

.task-name {
    font-weight: 600;
    color: #c9d1d9;
    font-size: 11px;
}

.task-status {
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 9px;
    font-weight: 500;
}

.task-status.running {
    background: #1a472a;
    color: #3fb950;
}

.task-status.completed {
    background: #1a472a;
    color: #3fb950;
}

.task-status.failed {
    background: #490202;
    color: #f85149;
}

.task-status.pending {
    background: #4d2d00;
    color: #d29922;
}

.task-info {
    font-size: 10px;
    color: #8b949e;
}

.task-progress {
    margin-top: 8px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #21262d;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #58a6ff;
    transition: width 0.3s ease;
}

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

.modal-content {
    background: #161b22;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #30363d;
    border-radius: 8px;
    width: 90%;
    height: 80%;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #30363d;
    background: #21262d;
}

.modal-header h3 {
    color: #58a6ff;
    font-size: 14px;
}

.close-btn {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #30363d;
    color: #f85149;
}

/* Health Status Table */
.health-modal-content {
    max-width: 1200px;
    width: 90vw;
    max-height: 80vh;
}

.health-status-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}

.health-status-table th,
.health-status-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #30363d;
    vertical-align: top;
}

.health-status-table th {
    background: #21262d;
    color: #58a6ff;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.health-status-table tr:hover {
    background: #161b22;
}

.service-row.running {
    border-left: 3px solid #3fb950;
}

.service-row.stopped {
    border-left: 3px solid #f85149;
}

.service-row.unknown {
    border-left: 3px solid #8b949e;
}

.service-name {
    display: flex;
    align-items: center;
    gap: 6px;
}

.service-type {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #8b949e;
    text-transform: capitalize;
}

.ip-address, .port-number {
    background: #21262d;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #c9d1d9;
}

.service-details {
    max-width: 200px;
    word-wrap: break-word;
    font-size: 11px;
    color: #8b949e;
}

.health-summary {
    margin-top: 20px;
    padding: 15px;
    background: #0d1117;
    border-radius: 6px;
    border: 1px solid #30363d;
}

.summary-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.summary-stats .stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
}

.summary-stats .stat.running {
    color: #3fb950;
}

.summary-stats .stat.stopped {
    color: #f85149;
}

.summary-stats .stat.unknown {
    color: #8b949e;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-running {
    background: #238636;
    color: #ffffff;
}

.status-badge.status-stopped {
    background: #da3633;
    color: #ffffff;
}

.status-badge.status-unknown {
    background: #8b949e;
    color: #ffffff;
}

/* Status indicators */
.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    transition: all 0.2s ease;
}

.status-dot.running {
    background: #3fb950;
    box-shadow: 0 0 6px rgba(63, 185, 80, 0.4);
}

.status-dot.stopped {
    background: #f85149;
    box-shadow: 0 0 6px rgba(248, 81, 73, 0.4);
}

.status-dot.unknown {
    background: #8b949e;
    box-shadow: 0 0 6px rgba(139, 148, 158, 0.4);
}

.status-dot:hover {
    transform: scale(1.2);
}

/* Poetry Commands Panel */
.command-categories {
    padding: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.command-category {
    margin-bottom: 20px;
}

.command-category h4 {
    color: #58a6ff;
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.command-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.poetry-cmd {
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.poetry-cmd:hover {
    background: #30363d;
    border-color: #58a6ff;
    color: #58a6ff;
}

.poetry-cmd:active {
    background: #1f6feb;
    border-color: #1f6feb;
    color: white;
}

.command-output {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 10px;
    margin: 10px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #c9d1d9;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.command-output.success {
    border-color: #3fb950;
    background: rgba(63, 185, 80, 0.1);
}

.command-output.error {
    border-color: #f85149;
    background: rgba(248, 81, 73, 0.1);
}

.modal-body {
    flex: 1;
    overflow: hidden;
}

.file-content {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px;
    line-height: 1.4;
    background: #0d1117;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 20px;
    background: #161b22;
    border-top: 1px solid #30363d;
    height: 60px;
    flex-shrink: 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-label {
    font-size: 10px;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #58a6ff;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #8b949e;
    font-style: italic;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #161b22;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* Log Pagination */
.log-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #161b22;
    border-top: 1px solid #30363d;
    font-size: 11px;
}

.pagination-info {
    color: #8b949e;
    font-family: 'Courier New', monospace;
}

.pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-controls .btn {
    padding: 4px 8px;
    font-size: 10px;
    min-width: auto;
}

.pagination-controls .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Log Tab Info */
.log-tab-info {
    font-size: 9px;
    color: #8b949e;
    margin-left: 4px;
}

.log-tab-icon {
    margin-right: 6px;
}

.log-tab-name {
    flex: 1;
}

/* Log Content Improvements */
.log-content {
    position: relative;
}

.log-line {
    padding: 2px 0;
    border-bottom: 1px solid transparent;
    transition: background-color 0.1s ease;
}

.log-line:hover {
    background: rgba(255, 255, 255, 0.05);
}

.log-line.error {
    color: #f85149;
    background: rgba(248, 81, 73, 0.1);
}

.log-line.warning {
    color: #d29922;
    background: rgba(210, 153, 34, 0.1);
}

.log-line.info {
    color: #58a6ff;
}

.log-line.success {
    color: #3fb950;
}

.log-line.debug {
    color: #8b949e;
    opacity: 0.8;
}

/* Loading State */
.log-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: #8b949e;
    font-style: italic;
}

.log-loading::before {
    content: "⏳";
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 1200px) {
    .sidebar {
        width: 250px;
    }
}

@media (max-width: 900px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 200px;
    }

    .center-panel {
        height: auto;
        flex: 1;
    }

    .pagination-controls {
        flex-wrap: wrap;
        gap: 4px;
    }

    .pagination-controls .btn {
        font-size: 9px;
        padding: 3px 6px;
    }
}

/* Fullscreen Modal Styles */
.fullscreen-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.fullscreen-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    width: 95%;
    height: 90%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #30363d;
    background: #161b22;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #c9d1d9;
    font-size: 18px;
    font-weight: 600;
}

.modal-controls {
    display: flex;
    gap: 8px;
}

.modal-controls .btn {
    padding: 6px 12px;
    font-size: 12px;
    min-width: auto;
}

.modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-log-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #0d1117;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #c9d1d9;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.modal-log-content::-webkit-scrollbar {
    width: 8px;
}

.modal-log-content::-webkit-scrollbar-track {
    background: #21262d;
}

.modal-log-content::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

.modal-log-content::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* Log line styling in modal */
.modal-log-content .log-line {
    margin: 0;
    padding: 2px 0;
    border-bottom: 1px solid transparent;
}

.modal-log-content .log-line:hover {
    background: rgba(255, 255, 255, 0.05);
}

.modal-log-content .log-line.error {
    color: #f85149;
    background: rgba(248, 81, 73, 0.1);
}

.modal-log-content .log-line.warning {
    color: #d29922;
    background: rgba(210, 153, 34, 0.1);
}

.modal-log-content .log-line.info {
    color: #58a6ff;
}

.modal-log-content .log-line.debug {
    color: #8b949e;
}

/* Fullscreen button styling */
#fullscreen-logs {
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    transition: all 0.2s ease;
}

#fullscreen-logs:hover {
    background: #30363d;
    border-color: #58a6ff;
    color: #58a6ff;
    transform: scale(1.05);
}
