/*
 * Shipshape FM — Component library
 *
 * Reusable visual patterns. Every other template references these classes.
 */

/* ─── Brand wordmark ───────────────────────────────────────────────── */

.brand-wordmark {
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--accent);
    letter-spacing: -0.5px;
    line-height: 1;
    display: inline-flex;
    align-items: baseline;
    gap: 0;
}

.brand-wordmark .brand-shipshape {
    color: var(--accent);
}

.brand-wordmark .brand-fm {
    color: var(--teal);
}

.brand-tagline {
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: var(--space-2);
}

/* ─── Cards ────────────────────────────────────────────────────────── */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
}

.card-tight {
    padding: var(--space-5);
}

.card-elevated {
    box-shadow: var(--shadow-md);
}

/* ─── Buttons ──────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 11px var(--space-5);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base);
    line-height: 1;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: #023a6b;
    border-color: #023a6b;
    color: #ffffff;
}

.btn-secondary {
    background: var(--card);
    color: var(--ink);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--ink-soft);
    color: var(--ink);
}

.btn-ghost {
    background: transparent;
    color: var(--ink-soft);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--ink);
}

.btn-danger {
    background: var(--red);
    color: #ffffff;
    border-color: var(--red);
}

.btn-danger:hover {
    background: #a83020;
    border-color: #a83020;
    color: #ffffff;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 7px var(--space-3);
    font-size: var(--text-sm);
}

/* ─── Form fields ──────────────────────────────────────────────────── */

.field {
    margin-bottom: var(--space-5);
}

.field-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    margin-bottom: var(--space-2);
}

.field-input,
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="url"],
.field input[type="number"],
.field input[type="date"],
.field input[type="file"],
.field textarea,
.field select {
    width: 100%;
    padding: 11px var(--space-3);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--card);
    transition: border-color var(--transition-fast);
}

.field-input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--teal);
}

.field-help {
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--ink-soft);
    line-height: 1.5;
}

.field-error,
.errorlist {
    list-style: none;
    padding: 0;
    margin: var(--space-2) 0 0;
    color: var(--red);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

.errorlist li {
    margin-bottom: 2px;
}

/* Multi-column form rows */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
}

.form-row .field {
    margin-bottom: var(--space-5);
}

.form-section-title {
    font-family: var(--font-serif);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    margin-bottom: var(--space-5);
    letter-spacing: -0.3px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding-top: var(--space-4);
}

.form-actions-split {
    justify-content: space-between;
}

.form-actions-right {
    display: flex;
    gap: var(--space-3);
}

/* Danger zone — destructive actions separated visually from the main form */
.form-danger-zone {
    margin-top: var(--space-8);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}

.btn-danger-ghost {
    color: var(--red);
}

.btn-danger-ghost:hover {
    background: var(--red-bg);
    color: var(--red);
}

/* ─── Status pills ─────────────────────────────────────────────────── */

.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 4px 11px;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
}

.pill-success {
    background: var(--green-bg);
    color: var(--green);
}

.pill-danger {
    background: var(--red-bg);
    color: var(--red);
}

.pill-warn {
    background: var(--amber-bg);
    color: var(--amber);
}

.pill-info {
    background: var(--blue-bg);
    color: var(--blue);
}

.pill-accent {
    background: var(--accent-bg);
    color: var(--accent);
}

.pill-teal {
    background: var(--teal-bg);
    color: var(--teal);
}

.pill-neutral {
    background: var(--slate-bg);
    color: var(--slate);
}

/* ─── Tags (smaller, more utilitarian than pills) ──────────────────── */

.tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px var(--space-2);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--ink-soft);
    background: var(--bg);
    border: 1px solid var(--border);
}

/* ─── Page head (serif title + muted supporting text) ──────────────── */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.page-head-content {
    flex: 1;
    min-width: 0;
}

.page-breadcrumb {
    font-size: var(--text-sm);
    color: var(--ink-soft);
    margin-bottom: var(--space-2);
}

.page-breadcrumb a {
    color: var(--ink-soft);
    text-decoration: none;
}

.page-breadcrumb a:hover {
    color: var(--teal);
}

.page-title {
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    letter-spacing: -1.1px;
    line-height: 1.05;
    margin: 0;
}

.page-subtitle {
    font-size: var(--text-base);
    color: var(--ink-soft);
    line-height: 1.55;
    margin-top: var(--space-2);
    max-width: 640px;
}

.page-actions {
    display: flex;
    gap: var(--space-3);
    flex-shrink: 0;
}

/* ─── Flash messages ───────────────────────────────────────────────── */

.message {
    padding: 11px var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-2);
    border: 1px solid transparent;
}

.message.success {
    background: var(--green-bg);
    color: var(--green);
    border-color: var(--green);
}

.message.info {
    background: var(--blue-bg);
    color: var(--blue);
    border-color: var(--blue);
}

.message.warning {
    background: var(--amber-bg);
    color: var(--amber);
    border-color: var(--amber);
}

.message.error {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red);
}

/* ─── Empty state ──────────────────────────────────────────────────── */

.empty-state {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-12) var(--space-5);
    text-align: center;
    color: var(--ink-soft);
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--bg);
    display: grid;
    place-items: center;
    color: var(--muted);
}

.empty-state-title {
    font-family: var(--font-serif);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    margin-bottom: var(--space-2);
}

.empty-state-text {
    font-size: var(--text-sm);
    color: var(--ink-soft);
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ─── Modules summary (dashboard) ──────────────────────────────────── */

.modules-summary-title {
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    letter-spacing: -0.4px;
    margin-bottom: var(--space-4);
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-3);
}

.module-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.module-card.module-off {
    background: var(--bg);
    border-style: dashed;
}

.module-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.module-name {
    font-family: var(--font-serif);
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    letter-spacing: -0.2px;
}

.module-card.module-off .module-name {
    color: var(--ink-soft);
}

.module-blurb {
    font-size: var(--text-sm);
    color: var(--ink-soft);
    line-height: 1.5;
}

.module-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.module-card-link:hover {
    border-color: var(--teal);
    color: inherit;
}

.module-card-link:hover .module-name {
    color: var(--teal);
}

/* ─── Data table (list views) ──────────────────────────────────────── */

.data-table-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.data-table thead {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.data-table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

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

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

.data-table td {
    padding: var(--space-3) var(--space-4);
    color: var(--ink);
    vertical-align: middle;
}

.data-table-primary-link {
    color: var(--ink);
    font-weight: var(--weight-semibold);
    text-decoration: none;
}

.data-table-primary-link:hover {
    color: var(--teal);
}

.data-table-row-actions {
    text-align: right;
}

.data-table-row-actions a {
    font-size: var(--text-sm);
    color: var(--ink-soft);
    text-decoration: none;
}

.data-table-row-actions a:hover {
    color: var(--teal);
}

/* ─── Detail grid (record view) ────────────────────────────────────── */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
}

.detail-section-full {
    grid-column: 1 / -1;
}

.detail-section-title {
    font-family: var(--font-serif);
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    margin-bottom: var(--space-4);
    letter-spacing: -0.2px;
}

.detail-line {
    margin: 0 0 var(--space-1);
    color: var(--ink);
    font-size: var(--text-sm);
}

.detail-list {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(120px, auto) 1fr;
    gap: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
}

.detail-list dt {
    color: var(--ink-soft);
    font-weight: var(--weight-medium);
}

.detail-list dd {
    color: var(--ink);
    margin: 0;
}

.detail-notes {
    font-size: var(--text-sm);
    color: var(--ink);
    line-height: 1.6;
    margin: 0;
}

/* Header row inside a detail-section card — title left, action button right */
.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    gap: var(--space-3);
}

.detail-section-header .detail-section-title {
    margin-bottom: 0;
}

/* ─── Floor plans ──────────────────────────────────────────────────── */

.floor-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-4);
}

.floor-plan-card {
    padding: var(--space-5);
}

.floor-plan-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.floor-plan-name {
    font-family: var(--font-serif);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    letter-spacing: -0.3px;
    margin: 0;
    flex: 1;
    min-width: 0;
}

.floor-plan-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

.floor-plan-description {
    font-size: var(--text-sm);
    color: var(--ink-soft);
    line-height: 1.5;
    margin: 0 0 var(--space-3);
}

.floor-plan-meta {
    font-size: var(--text-xs);
    margin: 0;
}

/* Compact summary list shown on Location detail page */
.floor-plan-summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.floor-plan-summary-list li {
    font-size: var(--text-sm);
    line-height: 1.5;
}

.floor-plan-summary-name {
    font-weight: var(--weight-semibold);
    color: var(--ink);
    text-decoration: none;
}

.floor-plan-summary-name:hover {
    color: var(--teal);
}

/* ─── Documents ────────────────────────────────────────────────────── */

/* Document summary list shown on Location detail page — capped height with scroll */
.document-summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: 320px;
    overflow-y: auto;
    /* Padding so the scrollbar doesn't sit flush against the content */
    padding-right: var(--space-2);
}

/* Subtle scrollbar styling (WebKit only — Firefox uses its default) */
.document-summary-list::-webkit-scrollbar {
    width: 8px;
}

.document-summary-list::-webkit-scrollbar-track {
    background: transparent;
}

.document-summary-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.document-summary-list::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

.document-summary-list li {
    font-size: var(--text-sm);
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.document-summary-title {
    font-weight: var(--weight-semibold);
    color: var(--ink);
    text-decoration: none;
}

.document-summary-title:hover {
    color: var(--teal);
}

.document-summary-category {
    font-size: var(--text-xs);
}

/* ─── Activity log ─────────────────────────────────────────────────── */

.activity-entry-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.activity-entry-textarea {
    width: 100%;
    padding: var(--space-3);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--card);
    resize: vertical;
    min-height: 60px;
}

.activity-entry-textarea:focus {
    outline: none;
    border-color: var(--teal);
}

.activity-entry-form-actions {
    display: flex;
    justify-content: flex-end;
}

.activity-entry-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    max-height: 480px;
    overflow-y: auto;
    padding-right: var(--space-2);
}

.activity-entry-list::-webkit-scrollbar {
    width: 8px;
}

.activity-entry-list::-webkit-scrollbar-track {
    background: transparent;
}

.activity-entry-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.activity-entry-list::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

.activity-entry {
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.activity-entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-entry-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
    font-size: var(--text-xs);
    flex-wrap: wrap;
}

.activity-entry-author {
    font-weight: var(--weight-semibold);
    color: var(--ink);
}

.activity-entry-time {
    font-size: var(--text-xs);
}

.activity-entry-edit {
    margin-left: auto;
    font-size: var(--text-xs);
    text-decoration: none;
    color: var(--ink-soft);
}

.activity-entry-edit:hover {
    color: var(--teal);
}

.activity-entry-body {
    font-size: var(--text-sm);
    color: var(--ink);
    line-height: 1.55;
    white-space: pre-wrap;
}

.activity-entry-edit-marker,
.activity-entry-delete-marker {
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    font-style: italic;
}

/* Soft-deleted entries — strikethrough body, dimmed appearance */
.activity-entry-deleted .activity-entry-body {
    text-decoration: line-through;
    color: var(--muted);
}

.activity-entry-deleted .activity-entry-author {
    color: var(--muted);
}
/* ─── Email verification banner ────────────────────────────────────── */

.verification-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.verification-banner-form {
    margin: 0;
}

.verification-banner-link {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--amber);
    font-weight: var(--weight-semibold);
    font-size: inherit;
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
}

.verification-banner-link:hover {
    text-decoration: none;
}

/* ─── Utility ──────────────────────────────────────────────────────── */

.muted {
    color: var(--ink-soft);
}

.center-text {
    text-align: center;
}

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }