/* Phase 3A — User management, browse views */

/* Primary horizontal navigation in the header */
.primary-nav {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    margin: 0 auto 0 2rem;
    flex: 1;
}

.primary-nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.5rem 0.25rem;
    border-bottom: 2px solid transparent;
    transition: border-color 0.15s, color 0.15s;
}

.primary-nav a:hover {
    color: white;
    border-bottom-color: var(--fuse-orange, #ff8c42);
}

/* Make the user-nav not stretch */
.site-header .user-nav {
    flex: 0 0 auto;
}

/* Data tables — used across users, buildings, parties */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 2rem;
    font-size: 0.95rem;
}

.data-table thead th {
    text-align: left;
    border-bottom: 2px solid var(--fuse-blue, #1e3a8a);
    padding: 0.6rem 0.75rem;
    color: var(--fuse-blue, #1e3a8a);
    font-weight: 600;
    background: var(--fuse-light, #f0f4ff);
}

.data-table tbody td {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.6rem 0.75rem;
    vertical-align: top;
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.data-table .muted-row {
    background: #fafafa;
    color: #666;
}

.data-table small {
    color: #6b7280;
    font-size: 0.85em;
}

/* Compact lists — for relationship summaries inside table cells */
.compact-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.compact-list li {
    padding: 0.15rem 0;
    font-size: 0.9rem;
}

/* Meta grids — building/unit/party metadata blocks */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 2rem;
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background: var(--fuse-light, #f0f4ff);
    border-radius: 6px;
}

.meta-grid > div {
    line-height: 1.5;
    font-size: 0.95rem;
}

.meta-grid strong {
    display: block;
    color: var(--fuse-blue, #1e3a8a);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

/* Subtitles below page headings */
.subtitle {
    color: #6b7280;
    font-size: 1.05rem;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

/* Badges — status pills */
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #e5e7eb;
    color: #374151;
}

.badge.success { background: #d1fae5; color: #065f46; }
.badge.warn    { background: #fef3c7; color: #92400e; }
.badge.danger  { background: #fee2e2; color: #991b1b; }

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    border-left: 4px solid;
}
.flash.success { background: #d1fae5; color: #065f46; border-color: #059669; }
.flash.error   { background: #fee2e2; color: #991b1b; border-color: #dc2626; }
.flash.info    { background: #dbeafe; color: #1e40af; border-color: #2563eb; }

/* Form elements */
fieldset {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1rem 1.5rem 1.25rem;
    margin: 1.5rem 0;
    background: #fafafa;
}

fieldset legend {
    font-weight: 600;
    color: var(--fuse-blue, #1e3a8a);
    padding: 0 0.5rem;
}

fieldset label {
    display: block;
    margin: 0.75rem 0;
    font-weight: 500;
}

fieldset label input[type="text"],
fieldset label input[type="email"],
fieldset label select,
fieldset label textarea {
    width: 100%;
    max-width: 500px;
    margin-top: 0.25rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
}

fieldset label input:focus,
fieldset label select:focus {
    outline: 2px solid var(--fuse-blue, #1e3a8a);
    outline-offset: -1px;
    border-color: var(--fuse-blue, #1e3a8a);
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.form-actions a {
    color: #6b7280;
}

/* Buttons */
.button {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: white;
    border: 1px solid var(--fuse-blue, #1e3a8a);
    color: var(--fuse-blue, #1e3a8a);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
}

.button:hover {
    background: var(--fuse-light, #f0f4ff);
}

.button.primary {
    background: var(--fuse-blue, #1e3a8a);
    color: white;
}

.button.primary:hover {
    background: #1e3a8a;
    opacity: 0.9;
}

.link-button {
    background: none;
    border: none;
    color: var(--fuse-blue, #1e3a8a);
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
    font-family: inherit;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
}

.link-button.danger {
    color: #dc2626;
}

/* Logout button in site header — white on dark nav, with hover feedback */
.user-nav .link-button {
    color: white;
}

.user-nav .link-button:hover {
    opacity: 0.85;
}

/* Error pages */
.error-page {
    max-width: 600px;
    margin: 4rem auto;
    text-align: center;
}

/* Help text — explanatory text near forms and tables */
.help-text {
    color: #4b5563;
    font-size: 0.95rem;
    background: #f9fafb;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--fuse-blue, #1e3a8a);
    border-radius: 4px;
    margin: 1rem 0 1.5rem;
}
