/* Services Module Styles */

.services-container {
    position: relative;
}

/* Header */
.services-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-stats {
    display: flex;
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 80px;
}

.stat-item .stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.stat-item .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item.running .stat-number { color: var(--success); }
.stat-item.warning .stat-number { color: var(--warning); }
.stat-item.stopped .stat-number { color: var(--error); }
.stat-item.total .stat-number { color: var(--primary); }

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

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

.search-box svg {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.875rem;
    width: 180px;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.header-actions select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
}

.header-actions select:focus {
    outline: none;
    border-color: var(--primary);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

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

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.service-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.service-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.service-card.hidden {
    display: none;
}

.service-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.service-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: 8px;
    color: var(--primary);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.running {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-badge.stopped {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.running .status-dot {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.card-body {
    padding: 1rem;
}

.service-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.service-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.service-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.meta-item svg {
    color: var(--primary);
}

.card-actions {
    display: flex;
    border-top: 1px solid var(--border);
}

.card-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-btn:hover {
    background: var(--surface-hover);
    color: var(--primary);
}

.card-btn:not(:last-child) {
    border-right: 1px solid var(--border);
}

/* Skeleton Loading */
.service-card.skeleton {
    pointer-events: none;
}

.service-card.skeleton .card-header,
.service-card.skeleton .card-body,
.service-card.skeleton .card-actions {
    display: none;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, var(--border) 25%, var(--surface-hover) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin: 1rem;
}

.skeleton-line.short {
    width: 60%;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Detail Panel */
.service-detail-panel {
    position: fixed;
    top: 64px;
    right: -450px;
    width: 450px;
    height: calc(100vh - 64px);
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.service-detail-panel.open {
    right: 0;
}

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

.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

/* Detail Content Sections */
.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.detail-value {
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.detail-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.detail-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

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

.detail-btn.secondary:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.detail-btn.danger {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
}

.detail-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .services-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-stats {
        justify-content: space-between;
    }

    .stat-item {
        flex: 1;
        min-width: auto;
        padding: 0.5rem;
    }

    .stat-item .stat-number {
        font-size: 1.25rem;
    }

    .header-actions {
        flex-wrap: wrap;
    }

    .search-box {
        flex: 1;
        min-width: 150px;
    }

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

    .services-grid {
        grid-template-columns: 1fr;
    }

    .service-detail-panel {
        width: 100%;
        right: -100%;
    }
}
