/* ═══════════════════════════════════════════════════════════════════════════
   Shared UI Components — sg-* prefix
   Reusable buttons, cards, form layouts, legends, action bars.
   Loaded globally via printHeader().
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page Section Wrapper ─────────────────────────────────────────────────── */

.sg-search-section {
    max-width: 680px;
    margin: 0 auto 24px;
}

.sg-search-section h1,
.sg-search-section h2 {
    text-align: center;
    color: #026565;
    font-weight: 600;
    margin: 16px 0 20px;
}

.sg-search-section h1 { font-size: 24px; }
.sg-search-section h2 { font-size: 20px; }

/* ── Card ─────────────────────────────────────────────────────────────────── */

.sg-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px 24px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.sg-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #026565;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #026565;
}

/* ── Form Grid ────────────────────────────────────────────────────────────── */

.sg-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
}

.sg-form-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.sg-form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #444;
}

.sg-form-group label span {
    font-weight: 400;
    color: #888;
    font-size: 11px;
}

.sg-form-group input[type="text"],
.sg-form-group input[type="number"],
.sg-form-group input[type="date"],
.sg-form-group input:not([type]),
.sg-form-group select,
.sg-form-group textarea {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.sg-form-group textarea {
    height: auto;
    padding: 8px 10px;
    resize: vertical;
    min-height: 80px;
}

.sg-form-group input:focus,
.sg-form-group select:focus,
.sg-form-group textarea:focus {
    outline: none;
    border-color: #026565;
    box-shadow: 0 0 0 2px rgba(2,101,101,0.12);
}

/* Input with inline suffix (e.g. "mg", "months ago") */
.sg-input-suffix {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sg-input-suffix input {
    flex: 1;
    min-width: 50px;
}

.sg-input-suffix .suffix {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

/* Full-width row spanning all grid columns */
.sg-form-full {
    grid-column: 1 / -1;
    margin-top: 6px;
}

/* 4-column sub-row inside a form grid */
.sg-form-row-4 {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px 14px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.sg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.sg-btn i { font-size: 13px; }

/* Primary: solid teal */
.sg-btn-primary {
    background: #026565;
    color: #fff;
    border-color: #026565;
}
.sg-btn-primary:hover {
    background: #034e4e;
    border-color: #034e4e;
}

/* Outlined: teal border, white bg */
.sg-btn-outline {
    background: #fff;
    color: #026565;
    border-color: #026565;
}
.sg-btn-outline:hover {
    background: #f0f7f7;
}

/* Ghost: subtle, light border */
.sg-btn-ghost {
    background: transparent;
    color: #026565;
    border-color: #ddd;
}
.sg-btn-ghost:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

/* Small size (for use inside tables) */
.sg-btn-sm {
    padding: 2px 6px;
    font-size: 12px;
}

/* Disabled state (all variants) */
.sg-btn:disabled,
.sg-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Action Bar ───────────────────────────────────────────────────────────── */

.sg-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
}

/* ── Color Legend ──────────────────────────────────────────────────────────── */

.sg-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 16px auto 20px;
    max-width: 680px;
    font-size: 12px;
    color: #555;
}

.sg-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.sg-legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}

/* ── Search Hint ──────────────────────────────────────────────────────────── */

.sg-search-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #888;
}
