/* Bulma Dark Theme - Container Platform */
/* Colors inspired by Vercel/Fly.io */

:root {
    /* Dark theme colors */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-hover: #222222;
    --border-color: #333333;
    --border-light: #444444;
    --text-primary: #ededed;
    --text-secondary: #888888;
    --text-muted: #666666;

    /* Accent colors */
    --accent-blue: #0070f3;
    --accent-blue-hover: #0060df;
    --accent-green: #50e3c2;
    --accent-green-dark: #3ecf8e;
    --accent-red: #ee0000;
    --accent-red-hover: #cc0000;
    --accent-yellow: #f5a623;
    --accent-purple: #7928ca;
    --accent-cyan: #79ffe1;

    /* Bulma overrides */
    --bulma-scheme-main: var(--bg-primary);
    --bulma-scheme-main-bis: var(--bg-secondary);
    --bulma-scheme-main-ter: var(--bg-tertiary);
    --bulma-background: var(--bg-primary);
    --bulma-border: var(--border-color);
    --bulma-text: var(--text-primary);
    --bulma-text-light: var(--text-secondary);
    --bulma-link: var(--accent-blue);
    --bulma-link-hover: var(--accent-blue-hover);
    --bulma-primary: var(--accent-green-dark);
    --bulma-danger: var(--accent-red);
    --bulma-warning: var(--accent-yellow);
    --bulma-info: var(--accent-blue);
    --bulma-success: var(--accent-green-dark);
}

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

/* Font Awesome spin animation (ensure it works) */
@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spin {
    animation: fa-spin 1s linear infinite;
}

/* HTMX loading states */

/* Hidden indicator - shows only during request */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons show loading state during request */
button.htmx-request,
.button.htmx-request,
[hx-post].htmx-request,
[hx-delete].htmx-request,
[hx-put].htmx-request,
[hx-patch].htmx-request {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
    position: relative;
}

/* Add spinner to buttons during request */
button.htmx-request::after,
.button.htmx-request::after {
    content: "";
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: fa-spin 0.6s linear infinite;
}

/* Forms - disable during submission */
form.htmx-request input,
form.htmx-request select,
form.htmx-request textarea,
form.htmx-request button {
    pointer-events: none;
    opacity: 0.7;
}

/* Loading placeholder for content areas */
.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    color: var(--text-secondary);
}

html {
    background-color: var(--bg-primary);
    min-height: 100vh;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Layout - Sidebar + Main Content */
body.has-sidebar {
    display: flex;
    min-height: 100vh;
}

.main-wrapper {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.sidebar-overlay.is-active {
    display: block;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    height: 56px;
    padding: 0 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
}

.sidebar-brand-link:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-brand-text {
    color: var(--accent-blue);
    font-weight: 600;
}

.sidebar-brand-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section-title {
    padding: 0 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.sidebar-menu {
    flex: 1;
    padding: 1rem 0.5rem;
    overflow-y: auto;
}

.sidebar-label {
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.sidebar-label:first-child {
    margin-top: 0;
}

.sidebar-item {
    margin: 2px 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-link.is-active {
    background: var(--bg-tertiary);
    color: var(--accent-blue);
}

.sidebar-link-icon {
    width: 18px;
    text-align: center;
    opacity: 0.7;
    flex-shrink: 0;
}

.sidebar-link:hover .sidebar-link-icon,
.sidebar-link.is-active .sidebar-link-icon {
    opacity: 1;
}

.sidebar-link-external {
    margin-left: auto;
    font-size: 0.625rem;
    opacity: 0.5;
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.sidebar-link:hover .sidebar-icon,
.sidebar-link.is-active .sidebar-icon {
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
}

.sidebar-user:hover {
    background: var(--bg-hover);
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-username {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 1.5rem;
}

.main-content-full {
    min-height: 100vh;
}

/* Top Bar */
.topbar {
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

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

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

/* Bulma breadcrumb override for dark theme */
.breadcrumb a {
    color: var(--text-secondary);
}

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

.breadcrumb li.is-active a {
    color: var(--text-primary);
}

.breadcrumb li + li::before {
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

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

/* Sidebar toggle (mobile) */
.sidebar-toggle {
    display: none;
}

/* Content Container */
.content-container {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
}

/* Cards / Boxes */
.box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

/* Make tables scrollable within boxes */
.table-scroll {
    overflow-x: auto;
    width: 100%;
}

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

.box-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

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

.box-header .box-title {
    margin-bottom: 0;
}

/* Legacy .card support */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2, .card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-desc, .card-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

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

.card-header h2 {
    margin-bottom: 0;
}

.card-actions, .card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.card-danger {
    border-color: var(--accent-red);
}

.card-danger h2 {
    color: var(--accent-red);
}

/* Buttons */
.button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.5;
}

.button:hover, .btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
    text-decoration: none;
}

.button.is-primary, .btn-primary {
    background: var(--accent-green-dark);
    border-color: var(--accent-green-dark);
    color: #000;
}

.button.is-primary:hover, .btn-primary:hover {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.button.is-danger, .btn-danger {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: #fff;
}

.button.is-danger:hover, .btn-danger:hover {
    background: var(--accent-red-hover);
    border-color: var(--accent-red-hover);
}

.button.is-link, .btn-link {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

.button.is-small, .btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.button.is-medium, .btn-medium {
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
}

.button.is-large, .btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Form Elements */
.field {
    margin-bottom: 1rem;
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input, .textarea, .select select, .form-input, .form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    transition: border-color 0.15s ease;
}

.input:focus, .textarea:focus, .select select:focus, .form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 112, 243, 0.1);
}

.input::placeholder, .textarea::placeholder {
    color: var(--text-muted);
}

.select {
    display: inline-block;
    position: relative;
}

.select select {
    padding-right: 2.5rem;
    appearance: none;
    cursor: pointer;
}

.select::after {
    content: "▼";
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.625rem;
    color: var(--text-muted);
    pointer-events: none;
}

.help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group,
.form-row .field {
    flex: 1;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

.form-inline {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-blue);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

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

.table.is-fullwidth {
    width: 100%;
}

.table.is-hoverable tbody tr:hover {
    background: var(--bg-hover);
}

/* Legacy table classes */
.deploy-table, .env-table, .metrics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.deploy-table th, .deploy-table td,
.env-table th, .env-table td,
.metrics-table th, .metrics-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.deploy-table th, .env-table th, .metrics-table th {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Tags / Badges */
.tag, .badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.tag.is-success, .badge-success, .badge-running {
    background: rgba(62, 207, 142, 0.15);
    color: var(--accent-green);
}

.tag.is-danger, .badge-danger, .badge-failed {
    background: rgba(238, 0, 0, 0.15);
    color: var(--accent-red);
}

.tag.is-warning, .badge-warning, .badge-pending {
    background: rgba(245, 166, 35, 0.15);
    color: var(--accent-yellow);
}

.tag.is-info, .badge-info, .badge-building, .badge-deploying {
    background: rgba(0, 112, 243, 0.15);
    color: var(--accent-blue);
}

.tag.is-primary, .badge-primary {
    background: rgba(62, 207, 142, 0.15);
    color: var(--accent-green);
}

.badge-stopped, .badge-muted {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.badge-preview {
    background: rgba(121, 40, 202, 0.15);
    color: var(--accent-purple);
}

.badge-deleted {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-running, .status-success {
    background: var(--accent-green);
}

.status-pending, .status-building {
    background: var(--accent-yellow);
}

.status-failed, .status-error {
    background: var(--accent-red);
}

.status-unknown, .status-stopped {
    background: var(--text-muted);
}

/* Grids */
.columns {
    display: flex;
    flex-wrap: wrap;
    margin: -0.75rem;
}

.column {
    flex: 1;
    padding: 0.75rem;
}

.column.is-half {
    flex: none;
    width: 50%;
}

.column.is-one-third {
    flex: none;
    width: 33.3333%;
}

.column.is-two-thirds {
    flex: none;
    width: 66.6667%;
}

.column.is-one-quarter {
    flex: none;
    width: 25%;
}

/* Legacy grid classes */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.deployment-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}

.billing-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.metrics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* Lists */
.repo-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.repo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.repo-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.repo-name {
    font-weight: 500;
    color: var(--text-primary);
}

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

.repo-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Metrics */
.metric-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--accent-blue);
    line-height: 1;
}

.metric-label {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 600;
    color: var(--accent-blue);
}

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

/* Logs */
.logs-container {
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-primary);
    border-radius: 6px;
}

.logs {
    padding: 1rem;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-secondary);
}

/* Code */
code {
    background: var(--bg-primary);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 0.875em;
    color: var(--accent-cyan);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Loading */
.loading {
    color: var(--text-muted);
    font-style: italic;
}

/* Links */
a {
    color: var(--accent-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Utilities */
.muted {
    color: var(--text-muted);
}

.text-muted {
    color: var(--text-muted);
}

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

.commit-msg {
    display: block;
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.secret-value {
    color: var(--text-muted);
    font-style: italic;
}

/* Alerts */
.alert, .notification {
    padding: 1rem 1.25rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.alert-warning, .notification.is-warning {
    background: rgba(245, 166, 35, 0.1);
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
}

.alert-danger, .notification.is-danger {
    background: rgba(238, 0, 0, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.alert-success, .notification.is-success {
    background: rgba(62, 207, 142, 0.1);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.warning-box {
    padding: 0.75rem 1rem;
    background: rgba(245, 166, 35, 0.1);
    border: 1px solid var(--accent-yellow);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--accent-yellow);
}

/* Progress Bar */
.progress-bar {
    display: flex;
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
    font-size: 0.75rem;
}

.progress-primary {
    background: var(--accent-green-dark);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.3s ease;
}

.progress-canary {
    background: var(--accent-yellow);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.3s ease;
}

/* Canary */
.canary-status-card, .hpa-status, .pvc-status, .scaled-object-status {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.canary-status-card h4, .hpa-status h4, .pvc-status h4, .scaled-object-status h4 {
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.canary-status-card .status-grid {
    grid-template-columns: repeat(4, 1fr);
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.status-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-item .value {
    font-size: 1.25rem;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

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

/* Phase colors */
.phase-initializing { color: var(--accent-blue); }
.phase-progressing { color: var(--accent-green-dark); }
.phase-promoting, .phase-finalising, .phase-succeeded { color: var(--accent-green); }
.phase-failed { color: var(--accent-red); }

/* Dropdowns */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
}

.dropdown.is-active .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Organizations dropdown (legacy) */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 6px;
}

.nav-dropdown-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-arrow {
    font-size: 0.625rem;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 220px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    margin-top: 0.5rem;
}

.nav-dropdown-content.show {
    display: block;
}

.org-list {
    padding: 0.5rem 0;
}

.org-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
}

.org-item:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

.org-item-new {
    color: var(--accent-blue);
}

.org-avatar-placeholder {
    width: 24px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.org-add-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.org-divider {
    margin: 0.5rem 1rem;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Avatar */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.avatar-small {
    width: 24px;
    height: 24px;
}

/* Billing */
.billing-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.billing-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.usage-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.usage-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.usage-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.usage-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.usage-stat-total {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 6px;
}

.usage-stat-total .usage-value {
    color: var(--accent-blue);
    font-size: 2rem;
}

.usage-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 150px;
    padding: 1rem 0;
}

.chart-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.bar-fill {
    width: 100%;
    background: var(--accent-blue);
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    max-height: 120px;
}

.bar-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    writing-mode: vertical-lr;
    transform: rotate(180deg);
}

/* Payment Methods */
.payment-methods-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.payment-method {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.payment-method-default {
    border-color: var(--accent-blue);
}

.payment-method-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-brand {
    font-weight: 500;
    text-transform: capitalize;
}

.card-number {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

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

.payment-method-actions {
    display: flex;
    gap: 0.5rem;
}

.pricing-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pricing-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.pricing-label {
    color: var(--text-secondary);
}

.pricing-value {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.pricing-free {
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.pricing-free .pricing-value {
    color: var(--accent-green);
}

/* Invitation */
.invitation-card {
    max-width: 500px;
    margin: 2rem auto;
    text-align: center;
}

.invitation-details {
    font-size: 1.125rem;
    margin: 1.5rem 0;
}

.invitation-actions {
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.invitation-meta {
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Members */
.member-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.member-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Hero (landing page) */
.hero-section {
    text-align: center;
    padding: 4rem 0;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.feature {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.feature h3 {
    margin-bottom: 0.5rem;
    color: var(--accent-blue);
}

/* Env Form */
.env-form {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
}

.env-form h4 {
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Footer (for non-sidebar pages like landing) */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* HTMX */
.htmx-request .loading {
    display: block;
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.is-active {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

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

@media (max-width: 768px) {
    .deployment-grid,
    .billing-grid {
        grid-template-columns: 1fr;
    }

    .columns {
        flex-direction: column;
    }

    .column.is-half,
    .column.is-one-third,
    .column.is-two-thirds,
    .column.is-one-quarter {
        width: 100%;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .form-row {
        flex-direction: column;
    }

    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .canary-status-card .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Setting rows */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.setting-info {
    flex: 1;
}

.setting-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Error message */
.error-message {
    color: var(--accent-red);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Stripe card element */
#card-element-container {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

#card-element {
    padding: 0.75rem;
    background: white;
    border-radius: 4px;
}

/* Metrics extras */
.metrics-table-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.app-name {
    font-weight: 500;
}

.app-slug {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.metric-cpu, .metric-memory {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 0.875rem;
}

.metric-na {
    color: var(--text-muted);
}

.deploy-stats {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.deploy-success {
    color: var(--accent-green);
}

.deploy-failed {
    color: var(--accent-red);
}

/* Preview deployments */
.preview-table {
    background: rgba(121, 40, 202, 0.02);
}

.preview-row {
    background: rgba(121, 40, 202, 0.05);
}

.preview-row:hover {
    background: rgba(121, 40, 202, 0.08);
}

/* Invite form */
.invite-form {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.invite-form h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.form-inline-compact {
    display: inline-flex;
    align-items: center;
}

.form-select-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Container for unauthenticated pages */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Navbar for logged out view */
.navbar.is-dark {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.navbar.is-dark .navbar-item {
    color: var(--text-primary);
}

.navbar.is-dark .navbar-item:hover {
    background-color: var(--bg-hover);
}

/* Hero section dark theme */
.hero {
    background: var(--bg-primary);
}

.hero .title {
    color: var(--text-primary);
}

.hero .subtitle {
    color: var(--text-secondary);
}
