/* ===================================================================
 * service-admin.css — Service Admin Panel Styles
 * Login page, info cards, API list, table extensions, stats cards.
 * Uses CSS variables from variables.css. Supports dark/light theme.
 * =================================================================== */

/* ===== Login Page ===== */
.login-overlay {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: hsl(var(--background));
    z-index: 1000;
}

.login-card {
    width: 100%; max-width: 400px;
    padding: 2.5rem 2rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-md);
}

.login-brand {
    text-align: center; margin-bottom: 2rem;
}

.login-brand-icon {
    width: 48px; height: 48px;
    margin: 0 auto 0.75rem;
    display: flex; align-items: center; justify-content: center;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-radius: var(--radius);
    font-size: 1.25rem; font-weight: 700;
}

.login-brand-title {
    font-size: 1.25rem; font-weight: 600;
    color: hsl(var(--foreground));
}

.login-brand-sub {
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

.login-form .form-group {
    margin-bottom: 1rem;
}

.login-form .form-label {
    display: block; margin-bottom: 0.35rem;
    font-size: 0.8rem; font-weight: 500;
    color: hsl(var(--foreground));
}

.login-form .form-input {
    width: 100%; padding: 0.6rem 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.login-form .form-input:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.login-error {
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    background: hsl(var(--destructive) / 0.1);
    color: hsl(var(--destructive));
    border-radius: var(--radius);
    font-size: 0.8rem;
    display: none;
}

.login-error.visible { display: block; }

.login-btn {
    width: 100%; padding: 0.65rem;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border: none; border-radius: var(--radius-btn);
    font-size: 0.875rem; font-weight: 500;
    cursor: pointer; transition: opacity 0.15s;
}

.login-btn:hover { opacity: 0.9; }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Service Info Cards ===== */
.service-info-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-card {
    padding: 1.25rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-card);
}

.info-card-label {
    font-size: 0.75rem; font-weight: 500;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase; letter-spacing: 0.05em;
}

.info-card-value {
    font-size: 1.5rem; font-weight: 700;
    color: hsl(var(--foreground));
    margin-top: 0.25rem;
}

.info-card-desc {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

/* Health dot */
.health-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.health-dot.up { background: hsl(var(--success)); }
.health-dot.down { background: hsl(var(--destructive)); }
.health-dot.unknown { background: hsl(var(--muted-foreground)); }

/* Port badge */
.port-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border-radius: var(--radius-full);
    font-size: 0.75rem; font-weight: 600;
    font-family: monospace;
}

/* ===== Stats Cards Row ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1rem 1.25rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-card);
    text-align: center;
}

.stat-card-value {
    font-size: 1.75rem; font-weight: 700;
    color: hsl(var(--foreground));
}

.stat-card-label {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

/* ===== Search / Filter Bar ===== */
.filter-bar {
    display: flex; flex-wrap: wrap;
    gap: 0.75rem; align-items: end;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-card);
}

.filter-group {
    display: flex; flex-direction: column; gap: 0.25rem;
}

.filter-group label {
    font-size: 0.7rem; font-weight: 500;
    color: hsl(var(--muted-foreground));
}

.filter-group input,
.filter-group select {
    padding: 0.45rem 0.65rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 0.8rem;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: hsl(var(--ring));
}

.filter-actions {
    display: flex; gap: 0.5rem; align-items: end;
}

/* ===== Data Table Extensions ===== */
.sa-table-wrap {
    overflow-x: auto;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-card);
    background: hsl(var(--card));
}

.sa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.sa-table thead {
    background: hsl(var(--secondary));
}

.sa-table th {
    padding: 0.65rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.sa-table td {
    padding: 0.6rem 1rem;
    border-top: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
}

.sa-table tbody tr:hover {
    background: hsl(var(--accent) / 0.5);
}

/* Pagination */
.sa-pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
    border-top: 1px solid hsl(var(--border));
}

.sa-pagination-btns {
    display: flex; gap: 0.35rem;
}

.sa-pagination-btns button {
    padding: 0.3rem 0.65rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 0.75rem;
    cursor: pointer;
}

.sa-pagination-btns button:hover:not(:disabled) {
    background: hsl(var(--accent));
}

.sa-pagination-btns button:disabled {
    opacity: 0.4; cursor: not-allowed;
}

.sa-pagination-btns button.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

/* Empty / Loading states */
.sa-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: hsl(var(--muted-foreground));
    font-size: 0.85rem;
}

.sa-loading {
    padding: 2rem; text-align: center;
}

.sa-spinner {
    display: inline-block;
    width: 24px; height: 24px;
    border: 3px solid hsl(var(--border));
    border-top-color: hsl(var(--primary));
    border-radius: 50%;
    animation: sa-spin 0.6s linear infinite;
}

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

/* ===== API List ===== */
.api-group {
    margin-bottom: 1rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-card);
    overflow: hidden;
}

.api-group-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem;
    background: hsl(var(--secondary));
    cursor: pointer;
    user-select: none;
    font-weight: 600; font-size: 0.85rem;
    color: hsl(var(--foreground));
}

.api-group-header:hover { opacity: 0.85; }

.api-group-header .toggle-icon {
    transition: transform 0.2s;
}

.api-group.collapsed .api-group-body { display: none; }
.api-group.collapsed .toggle-icon { transform: rotate(-90deg); }

.api-group-count {
    font-size: 0.7rem; font-weight: 500;
    padding: 0.1rem 0.4rem;
    background: hsl(var(--muted));
    border-radius: var(--radius-full);
    color: hsl(var(--muted-foreground));
    margin-left: 0.5rem;
}

.api-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.55rem 1rem;
    border-top: 1px solid hsl(var(--border));
    font-size: 0.8rem;
}

.api-method {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.65rem; font-weight: 700;
    font-family: monospace;
    min-width: 50px; text-align: center;
    text-transform: uppercase;
}

.api-method.get { background: hsl(var(--success) / 0.15); color: hsl(var(--success)); }
.api-method.post { background: hsl(220 90% 56% / 0.15); color: hsl(220 90% 56%); }
.api-method.put { background: hsl(var(--warning) / 0.15); color: hsl(var(--warning)); }
.api-method.delete { background: hsl(var(--destructive) / 0.15); color: hsl(var(--destructive)); }

.api-path {
    font-family: monospace;
    color: hsl(var(--foreground));
    flex-shrink: 0;
}

.api-desc {
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
}

/* ===== Page Section ===== */
.sa-section {
    margin-bottom: 1.5rem;
}

.sa-section-title {
    font-size: 0.95rem; font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 0.75rem;
    display: flex; align-items: center; gap: 0.5rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .login-card { margin: 1rem; }
    .service-info-row { grid-template-columns: 1fr 1fr; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .filter-bar { flex-direction: column; }
}

@media (max-width: 480px) {
    .service-info-row { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: 1fr; }
}
