/* Balanced Admin Lounge — Ramp Design System */

/* ===== CSS Custom Properties ===== */
:root {
    /* Backgrounds */
    --bg-page:           #FFFFFF;
    --bg-sidebar:        #1A1A1A;
    --bg-sidebar-hover:  #2A2A2A;
    --bg-sidebar-active: #333333;
    --bg-input:          #FFFFFF;
    --bg-table-header:   #FFFFFF;
    --bg-row-hover:      #FAFAFA;
    --bg-badge:          #F0F0F0;

    /* Text */
    --text-primary:      #1A1A1A;
    --text-secondary:    #6B6B6B;
    --text-tertiary:     #999999;
    --text-sidebar:      #CCCCCC;
    --text-sidebar-active: #FFFFFF;
    --text-link:         #1A1A1A;

    /* Accent / Brand */
    --accent-primary:    #E8F54A;
    --accent-primary-hover: #D4E040;
    --accent-text-on-primary: #1A1A1A;

    /* Borders & Dividers */
    --border-default:    #E5E5E5;
    --border-input:      #D1D1D1;
    --border-input-focus: #1A1A1A;

    /* Status */
    --status-success:    #22C55E;
    --status-warning:    #F59E0B;
    --status-error:      #EF4444;
    --status-neutral:    #6B6B6B;

    /* Layout */
    --sidebar-width:     208px;
}

/* ===== Reset / Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 18px;
    font-weight: 400;
    color: var(--text-primary);
    background: var(--bg-page);
    margin: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text-link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== Layout Shell ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 16px 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-sidebar-active);
    letter-spacing: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 0 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    color: var(--text-sidebar);
    font-size: 16px;
    font-weight: 400;
    text-decoration: none;
    transition: background 0.1s;
}

.sidebar-nav a:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    font-weight: 500;
}

.sidebar-nav a i {
    font-size: 18px;
    width: 18px;
    text-align: center;
    opacity: 0.7;
}

.sidebar-nav a.active i,
.sidebar-nav a:hover i {
    opacity: 1;
}

.sidebar-bottom {
    padding: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: auto;
}

.sidebar-bottom a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    color: var(--text-sidebar);
    font-size: 16px;
    text-decoration: none;
}

.sidebar-bottom a:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
    text-decoration: none;
}

.sidebar-user {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 15px;
}

.sidebar-user-name {
    color: var(--text-sidebar-active);
    font-weight: 500;
}

.sidebar-user-role {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    min-height: 100vh;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 35px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.page-title .count {
    font-weight: 400;
    color: var(--text-secondary);
}

/* ===== Breadcrumb ===== */
.breadcrumb {
    display: flex;
    gap: 6px;
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 0;
    list-style: none;
    background: none;
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--text-primary);
}

.breadcrumb-sep {
    color: var(--text-tertiary);
}

/* ===== Buttons ===== */
.btn-primary-accent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--accent-primary);
    color: var(--accent-text-on-primary);
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.1s;
}

.btn-primary-accent:hover {
    background: var(--accent-primary-hover);
    text-decoration: none;
    color: var(--accent-text-on-primary);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-page);
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.1s;
}

.btn-secondary:hover {
    background: var(--bg-row-hover);
    text-decoration: none;
    color: var(--text-primary);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: none;
    color: var(--text-primary);
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}

.btn-ghost:hover {
    background: var(--bg-row-hover);
    text-decoration: none;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: none;
    color: var(--status-error);
    border: 1px solid var(--status-error);
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

.btn-danger:hover {
    background: var(--status-error);
    color: #fff;
}

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

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    background: none;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
}

.btn-icon:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* Retry button spinner — spins while HTMX request is in flight */
.retry-btn.htmx-request i {
    animation: spin 0.8s linear infinite;
}
.retry-btn.htmx-request {
    pointer-events: none;
    opacity: 0.5;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== Tables ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
    text-align: left;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
    background: none;
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-default);
    font-size: 17px;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--bg-row-hover);
}
.data-table tbody tr.clickable-row {
    cursor: pointer;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .col-name {
    font-weight: 600;
}

.data-table .col-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.data-table .col-muted {
    color: var(--text-secondary);
    font-size: 16px;
}

.data-table .col-actions {
    text-align: right;
    white-space: nowrap;
}

.data-table .col-numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table .empty-row td {
    text-align: center;
    color: var(--text-tertiary);
    padding: 40px 16px;
    font-size: 17px;
}

/* Child row indent */
.data-table .child-row td:first-child {
    padding-left: 40px;
}

.child-indicator {
    color: var(--text-tertiary);
    margin-right: 6px;
}

/* ===== Tabs ===== */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-default);
    margin-bottom: 24px;
}

.tab-item {
    padding: 10px 16px;
    font-size: 17px;
    font-weight: 400;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.1s;
}

.tab-item:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.tab-item.active {
    color: var(--text-primary);
    font-weight: 600;
    border-bottom-color: var(--text-primary);
}

.tab-count {
    display: inline-block;
    background: var(--bg-badge);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

/* ===== Search / Filter Bar ===== */
.search-input {
    width: 280px;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--border-input);
    border-radius: 4px;
    font-size: 16px;
    color: var(--text-primary);
    background: var(--bg-input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 12px center;
    outline: none;
    transition: border-color 0.1s;
}

.search-input:focus {
    border-color: var(--border-input-focus);
}

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

/* ===== Form Inputs ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-input);
    border-radius: 4px;
    font-size: 17px;
    color: var(--text-primary);
    background: var(--bg-input);
    outline: none;
    transition: border-color 0.1s;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--border-input-focus);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-hint {
    font-size: 15px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.form-input-sm {
    padding: 6px 10px;
    font-size: 16px;
}

.form-select-sm {
    padding: 6px 10px;
    font-size: 16px;
}

/* Checkbox */
.form-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    color: var(--text-primary);
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--text-primary);
    cursor: pointer;
}

/* ===== Cards / Sections ===== */
.section-card {
    border: 1px solid var(--border-default);
    border-radius: 4px;
    margin-bottom: 20px;
}

.section-card-header {
    padding: 12px 16px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-default);
}

.section-card-body {
    padding: 16px;
}

/* ===== Status Text ===== */
.status-active {
    color: var(--status-success);
    font-weight: 500;
    font-size: 16px;
}

.status-inactive {
    color: var(--text-tertiary);
    font-size: 16px;
}

.status-failed {
    color: var(--status-error);
    font-weight: 500;
    font-size: 16px;
}

.status-warning {
    color: var(--status-warning);
    font-weight: 500;
    font-size: 16px;
}

.status-pending {
    color: var(--status-neutral);
    font-size: 16px;
}

.status-disabled {
    color: var(--text-tertiary);
    font-style: italic;
    font-size: 16px;
}

/* Highlight badge (for attention items) */
.highlight-badge {
    display: inline-block;
    background: var(--accent-primary);
    color: var(--accent-text-on-primary);
    font-size: 15px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Muted pill */
.muted-badge {
    display: inline-block;
    background: var(--bg-badge);
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
}

/* ===== Detail Grid ===== */
.detail-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 16px;
    font-size: 17px;
}

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

.detail-value {
    color: var(--text-primary);
}

/* ===== Two Column Layout ===== */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* ===== Flash Messages ===== */
.flash-message {
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flash-message.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.flash-message.danger,
.flash-message.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.flash-message.warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.flash-message.info {
    background: #f5f5f5;
    border: 1px solid var(--border-default);
    color: var(--text-primary);
}

.flash-close {
    background: none;
    border: none;
    font-size: 19px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0 4px;
}

.flash-close:hover {
    opacity: 1;
}

/* ===== Provisioning Steps ===== */
.step-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.step-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-default);
    font-size: 16px;
}

.step-item:last-child {
    border-bottom: none;
}

.step-name {
    color: var(--text-primary);
}

.step-error {
    font-size: 15px;
    color: var(--status-error);
    margin-top: 2px;
}

.step-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding: 16px;
    margin-bottom: 16px;
    background: none;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    gap: 2px;
    justify-content: center;
    margin-top: 24px;
    list-style: none;
    padding: 0;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    font-size: 16px;
    color: var(--text-primary);
    text-decoration: none;
}

.pagination a:hover {
    background: var(--bg-row-hover);
    text-decoration: none;
}

.pagination .active span {
    background: var(--text-primary);
    color: var(--bg-page);
    border-color: var(--text-primary);
}

.pagination .disabled span {
    color: var(--text-tertiary);
    cursor: default;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    max-width: 500px;
    margin: 0 auto;
}

.empty-state-title {
    font-size: 23px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-desc {
    font-size: 17px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ===== Login Page ===== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-page);
}

.login-box {
    width: 360px;
    padding: 40px 32px;
}

.login-brand {
    font-size: 23px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 32px;
}

/* ===== Inline form row ===== */
.inline-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

/* ===== Monospace ===== */
.mono {
    font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
    font-size: 16px;
    color: var(--text-secondary);
}

/* ===== Utility ===== */
.text-muted { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
.text-error { color: var(--status-error) !important; }
.text-success { color: var(--status-success) !important; }
.font-semibold { font-weight: 600; }
.font-normal { font-weight: 400; }
.text-sm { font-size: 16px; }
.text-xs { font-size: 15px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.d-inline { display: inline; }
.d-inline-flex { display: inline-flex; }
.nowrap { white-space: nowrap; }

/* ===== htmx ===== */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    .two-col {
        grid-template-columns: 1fr;
    }
    .search-input {
        width: 100%;
    }
}
