/* ============================================================
   Hamilton Place HOA — Design System
   Adapted from Kona design system. Clean, minimal, professional.
   ============================================================ */

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a8e;
    --primary-dark: #0f2440;
    --accent: #2d6a4f;
    --accent-light: #40916c;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --success: #059669;
    --success-light: #ecfdf5;
    --info: #0284c7;
    --info-light: #f0f9ff;
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --topbar-height: 56px;
    --sidebar-width: 240px;
}

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

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--primary); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.3;
    margin: 0 0 0.5em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }

/* ─── Layout ──────────────────────────────────────────────────────────────── */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-dark);
    color: var(--white);
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
}

.sidebar-brand h2 {
    color: var(--white);
    font-size: 1rem;
    margin: 0;
}

.sidebar-brand small {
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
}

.sidebar-nav { list-style: none; padding: 0; margin: 0; }

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
    transition: all 0.15s;
}

.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    text-decoration: none;
}

.sidebar-nav li a.active {
    background: rgba(255,255,255,0.15);
    color: var(--white);
    font-weight: 500;
}

.sidebar-nav li a svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-section {
    padding: 16px 20px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.4);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.topbar h1 {
    margin: 0;
    font-size: 1.5rem;
}

.topbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

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

.card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 20px;
    margin-bottom: 16px;
}

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

.card-header h3 { margin: 0; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 20px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 4px;
}

/* ─── Tables ──────────────────────────────────────────────────────────────── */

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

tbody tr:hover { background: var(--gray-50); }

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
    font-family: var(--font-sans);
}

.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-light); color: var(--white); }

.btn-accent {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-light); color: var(--white); }

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-50); }

.btn-danger {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; color: var(--white); }

.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-icon { padding: 6px; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    color: var(--gray-800);
    background: var(--white);
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

select.form-control { cursor: pointer; }

textarea.form-control { min-height: 120px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-help {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 2px;
}

/* ─── Flash Messages ──────────────────────────────────────────────────────── */

.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flash-success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.flash-danger  { background: var(--danger-light);  color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.flash-info    { background: var(--info-light);    color: #075985; border: 1px solid #bae6fd; }

/* ─── Badges ──────────────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-public  { background: #dbeafe; color: #1e40af; }
.badge-private { background: var(--gray-100); color: var(--gray-600); }
.badge-active  { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-role    { background: #e0e7ff; color: #3730a3; }

/* ─── Public Page ─────────────────────────────────────────────────────────── */

.public-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: var(--white);
    padding: 80px 24px 60px;
    text-align: center;
}

.public-header h1 {
    color: var(--white);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.public-header p {
    color: rgba(255,255,255,0.75);
    font-size: 1.1rem;
    margin: 0;
}

.public-nav {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.public-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 52px;
}

.public-nav-brand {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

.public-nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.public-nav-links a {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.public-nav-links a:hover { color: var(--primary); text-decoration: none; }

.public-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px;
}

.public-section + .public-section {
    border-top: 1px solid var(--gray-200);
}

.public-section h2 {
    font-size: 1.375rem;
    margin-bottom: 24px;
    color: var(--primary);
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.board-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.board-card-name {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.board-card-title {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
}

.doc-list {
    list-style: none;
    padding: 0;
}

.doc-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}

.doc-list li:last-child { border-bottom: none; }

.doc-list .doc-icon {
    width: 36px;
    height: 36px;
    background: var(--info-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--info);
    flex-shrink: 0;
}

.announcement-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.announcement-card h3 {
    margin-bottom: 4px;
}

.announcement-card .date {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-bottom: 12px;
}

.announcement-card .content {
    color: var(--gray-700);
    font-size: 0.9rem;
}

.public-footer {
    background: var(--gray-800);
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 32px 24px;
    font-size: 0.8rem;
}

/* ─── Utilities ───────────────────────────────────────────────────────────── */

.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.nowrap { white-space: nowrap; }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}

.empty-state p { font-size: 0.9rem; }

.connection-info {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--gray-700);
}

.connection-info dt {
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.connection-info dd {
    margin: 0 0 8px;
}

/* ─── Pagination ──────────────────────────────────────────────────────────── */

.pagination {
    display: flex;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 24px 0;
    justify-content: center;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    text-decoration: none;
}

.pagination a:hover { background: var(--gray-50); text-decoration: none; }
.pagination .active span { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .public-header h1 { font-size: 1.75rem; }
    .public-header { padding: 48px 24px 36px; }
    .board-grid { grid-template-columns: 1fr 1fr; }
    .public-nav-links { gap: 12px; }
}

@media (max-width: 480px) {
    .board-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr; }
}

/* Fix nav button text color override */
.public-nav-links .btn-primary,
.public-nav-links .btn-primary:hover {
    color: var(--white);
}
