/* ================================================================
   Flora.UI — Component Styles (Carbon Design System)
   Light + Dark via .dark class on <html>
   ================================================================ */

/* ── Button ────────────────────────────────────────────────────── */
.flora-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
}
.flora-btn:focus-visible { outline: 2px solid var(--flora-accent); outline-offset: 2px; }

/* Sizes */
.flora-btn-sm  { padding: 4px 10px;  font-size: 11px; }
.flora-btn-md  { padding: 7px 14px;  font-size: 13px; }
.flora-btn-lg  { padding: 10px 20px; font-size: 14px; }

/* Variants */
.flora-btn-primary {
    background: var(--flora-accent);
    border-color: var(--flora-accent);
    color: #fff;
}
.flora-btn-primary:hover { filter: brightness(1.1); box-shadow: 0 0 16px rgba(249,115,22,0.3); }

.flora-btn-secondary {
    background: var(--flora-surface-2);
    border-color: var(--flora-border);
    color: var(--flora-text-mid);
}
.flora-btn-secondary:hover { background: var(--flora-border); color: var(--flora-text-hi); }

.flora-btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--flora-text-lo);
}
.flora-btn-ghost:hover { background: var(--flora-surface-2); color: var(--flora-text-hi); }

.flora-btn-danger {
    background: rgba(239,68,68,0.12);
    border-color: rgba(239,68,68,0.3);
    color: #ef4444;
}
.flora-btn-danger:hover { background: rgba(239,68,68,0.2); }

.flora-btn-disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.flora-btn-icon { display: inline-flex; align-items: center; }

/* ── Badge ─────────────────────────────────────────────────────── */
.flora-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
}
.flora-badge-default { background: var(--flora-surface-2); border-color: var(--flora-border); color: var(--flora-text-lo); }
.flora-badge-success { background: rgba(34,197,94,0.12);  border-color: rgba(34,197,94,0.3);  color: #22c55e; }
.flora-badge-warning { background: rgba(234,179,8,0.12);  border-color: rgba(234,179,8,0.3);  color: #eab308; }
.flora-badge-danger  { background: rgba(239,68,68,0.12);  border-color: rgba(239,68,68,0.3);  color: #ef4444; }
.flora-badge-info    { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.3); color: #3b82f6; }
.flora-badge-accent  { background: rgba(249,115,22,0.12); border-color: rgba(249,115,22,0.3); color: #f97316; }

.flora-badge-dot-circle {
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
    animation: flora-pulse 2s infinite;
}
@keyframes flora-pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── Card ──────────────────────────────────────────────────────── */
.flora-card {
    background: var(--flora-surface);
    border: 1px solid var(--flora-border);
    border-radius: 12px;
    overflow: hidden;
}
.flora-card-hoverable {
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
}
.flora-card-hoverable:hover {
    border-color: var(--flora-accent);
    box-shadow: 0 0 0 1px var(--flora-accent-dim), 0 4px 16px rgba(0,0,0,0.12);
}
.flora-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--flora-border-sub);
}
.flora-card-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--flora-text-lo);
}
.flora-card-actions { display: flex; gap: 6px; align-items: center; }
.flora-card-body { padding: 16px; }
.flora-card-no-padding { padding: 0; }

/* ── Input ─────────────────────────────────────────────────────── */
.flora-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--flora-text-lo);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 5px;
}
.flora-label-required { color: var(--flora-danger); margin-left: 2px; }

.flora-input-inner { position: relative; }
.flora-input-with-icon .flora-input { padding-left: 34px; }
.flora-input-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--flora-text-dim);
    display: flex;
    align-items: center;
    pointer-events: none;
}

.flora-input {
    width: 100%;
    background: var(--flora-surface);
    border: 1px solid var(--flora-border);
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: var(--flora-text-hi);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.flora-input::placeholder { color: var(--flora-text-dim); }
.flora-input:focus {
    border-color: var(--flora-accent);
    box-shadow: 0 0 0 3px var(--flora-accent-dim);
}
.flora-input-error { border-color: var(--flora-danger) !important; }
.flora-input-error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.15) !important; }
.flora-input-error-msg { display: block; font-size: 11px; color: var(--flora-danger); margin-top: 4px; }
.flora-input-hint      { display: block; font-size: 11px; color: var(--flora-text-dim); margin-top: 4px; }
.flora-input-wrap      { display: flex; flex-direction: column; }

/* ── Table ─────────────────────────────────────────────────────── */
.flora-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--flora-border);
    border-radius: 12px;
}
.flora-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.flora-table thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--flora-text-lo);
    background: var(--flora-surface-2);
    border-bottom: 1px solid var(--flora-border);
    white-space: nowrap;
}
.flora-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--flora-border-sub);
    color: var(--flora-text-mid);
    vertical-align: middle;
}
.flora-table tbody tr:last-child td { border-bottom: none; }
.flora-table tbody tr {
    transition: background 0.1s;
}
.flora-table tbody tr:hover td {
    background: var(--flora-surface-2);
    color: var(--flora-text-hi);
}

/* ── Metric Card ───────────────────────────────────────────────── */
.flora-metric {
    background: var(--flora-surface);
    border: 1px solid var(--flora-border);
    border-radius: 12px;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 0.15s;
}
.flora-metric:hover { border-color: var(--flora-accent); }
.flora-metric-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--flora-text-dim); }
.flora-metric-value { font-size: 28px; font-weight: 800; color: var(--flora-text-hi); font-family: 'JetBrains Mono', monospace; line-height: 1.1; }
.flora-metric-value.accent  { color: var(--flora-accent); }
.flora-metric-value.success { color: var(--flora-success); }
.flora-metric-value.info    { color: var(--flora-info); }
.flora-metric-delta { font-size: 11px; color: var(--flora-text-dim); }
.flora-metric-delta.up   { color: var(--flora-success); }
.flora-metric-delta.down { color: var(--flora-danger); }

/* ── Divider ───────────────────────────────────────────────────── */
.flora-divider { border: none; border-top: 1px solid var(--flora-border); }

/* ── Skeleton loader ───────────────────────────────────────────── */
.flora-skeleton {
    background: linear-gradient(90deg, var(--flora-surface-2) 25%, var(--flora-border) 50%, var(--flora-surface-2) 75%);
    background-size: 200% 100%;
    animation: flora-shimmer 1.5s infinite;
    border-radius: 6px;
}
@keyframes flora-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Select ─────────────────────────────────────────────────────── */
.flora-select {
    appearance: none;
    background: var(--flora-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23626880' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1px solid var(--flora-border);
    border-radius: 8px;
    padding: 7px 32px 7px 11px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: var(--flora-text-hi);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.flora-select:focus {
    border-color: var(--flora-accent);
    box-shadow: 0 0 0 3px var(--flora-accent-dim);
}
.flora-select:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Segmented control ──────────────────────────────────────────── */
.flora-seg {
    display: inline-flex;
    background: var(--flora-surface-2);
    border: 1px solid var(--flora-border);
    border-radius: 8px;
    padding: 2px;
    gap: 1px;
}
.flora-seg-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--flora-text-lo);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
}
.flora-seg-btn:hover { color: var(--flora-text-hi); background: var(--flora-border); }
.flora-seg-btn.active {
    background: var(--flora-surface);
    color: var(--flora-text-hi);
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

/* ── Progress bar ───────────────────────────────────────────────── */
.flora-progress {
    width: 100%;
    height: 4px;
    background: var(--flora-surface-2);
    border-radius: 0;
    overflow: hidden;
}
.flora-progress-bar {
    height: 100%;
    background: var(--flora-accent);
    transition: width 0.4s ease;
}
.flora-progress-bar.success { background: var(--flora-success); }
.flora-progress-bar.warning { background: var(--flora-warning); }
.flora-progress-bar.danger  { background: var(--flora-danger);  }

/* ── Info banner ────────────────────────────────────────────────── */
.flora-info-banner {
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.25);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--flora-text-mid);
}

/* ── Link ───────────────────────────────────────────────────────── */
.flora-link {
    color: var(--flora-accent);
    text-decoration: none;
    font-weight: 500;
}
.flora-link:hover { text-decoration: underline; }

/* ── Modal Dialog ──────────────────────────────────────────────── */
.flora-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.flora-modal {
    background: var(--flora-surface);
    border: 1px solid var(--flora-border);
    border-radius: 14px;
    min-width: 340px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
}
.flora-modal-sm { max-width: 400px; }
.flora-modal-lg { max-width: 720px; }
.flora-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--flora-border);
    flex-shrink: 0;
}
.flora-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--flora-text-hi);
}
.flora-modal-body {
    padding: 20px;
    flex: 1;
}
.flora-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--flora-border);
    flex-shrink: 0;
}

/* ── Form grid ──────────────────────────────────────────────────── */
.flora-form-row {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}
.flora-form-row-2 { grid-template-columns: 1fr 1fr; }
.flora-form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.flora-form-field { display: flex; flex-direction: column; gap: 5px; }

/* ── Checkbox ───────────────────────────────────────────────────── */
.flora-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--flora-border-sub);
    cursor: pointer;
    user-select: none;
}
.flora-check-row:last-child { border-bottom: none; }
.flora-check-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--flora-accent);
    cursor: pointer;
    flex-shrink: 0;
}
.flora-check-row span {
    font-size: 13px;
    color: var(--flora-text-mid);
}
.flora-check-row.disabled { opacity: 0.5; cursor: not-allowed; }
.flora-check-row.disabled input { cursor: not-allowed; }

/* ── Toggle switch ──────────────────────────────────────────────── */
.flora-switch {
    display: inline-block;
    width: 36px;
    height: 20px;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
    background: var(--flora-border);
}
.flora-switch.on  { background: var(--flora-accent); }
.flora-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: transform 0.2s;
}
.flora-switch.on::after { transform: translateX(16px); }

/* ── Page header row ─────────────────────────────────────────────── */
.flora-page-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.flora-page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--flora-text-hi);
    letter-spacing: -0.3px;
}

/* ── Alert banner ───────────────────────────────────────────────── */
.flora-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}
.flora-alert-danger  { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.25);  color: #ef4444; }
.flora-alert-warning { background: rgba(234,179,8,0.1);  border-color: rgba(234,179,8,0.25);  color: #eab308; }
.flora-alert-info    { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.25); color: #3b82f6; }
.flora-alert-success { background: rgba(34,197,94,0.1);  border-color: rgba(34,197,94,0.25);  color: #22c55e; }

/* ── Toast notifications ────────────────────────────────────────── */
.flora-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
    pointer-events: none;
}
.flora-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    animation: flora-toast-in 0.2s ease;
    border: 1px solid transparent;
    pointer-events: all;
    backdrop-filter: blur(4px);
}
@keyframes flora-toast-in { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }
.flora-toast-success { background: rgba(34,197,94,0.15);  border-color: rgba(34,197,94,0.35);  color: #22c55e; }
.flora-toast-error   { background: rgba(239,68,68,0.15);  border-color: rgba(239,68,68,0.35);  color: #ef4444; }
.flora-toast-warning { background: rgba(234,179,8,0.15);  border-color: rgba(234,179,8,0.35);  color: #ca8a04; }
.flora-toast-info    { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.35); color: #3b82f6; }
.flora-toast-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.55;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
}
.flora-toast-close:hover { opacity: 1; }

/* ── Autocomplete ───────────────────────────────────────────────── */
.flora-ac-wrap { display: flex; flex-direction: column; }
.flora-ac-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--flora-surface);
    border: 1px solid var(--flora-border);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
    z-index: 9999;
    max-height: 260px;
    overflow-y: auto;
}
.flora-ac-item {
    padding: 9px 14px;
    font-size: 13px;
    color: var(--flora-text-mid);
    cursor: pointer;
    transition: background 0.1s;
}
.flora-ac-item:hover { background: var(--flora-surface-2); color: var(--flora-text-hi); }
.flora-ac-item:not(:last-child) { border-bottom: 1px solid var(--flora-border-sub); }

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--flora-border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--flora-text-dim); }
