/* SHR Scorecard Management System */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --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;
    --radius: 8px;
    --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.1), 0 2px 4px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.5;
}

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

/* Layout */
.navbar {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.navbar-brand { font-weight: 700; font-size: 18px; color: var(--gray-900); }
.navbar-nav { display: flex; gap: 4px; align-items: center; }
.navbar-nav a {
    padding: 6px 12px;
    border-radius: var(--radius);
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
}
.navbar-nav a:hover { background: var(--gray-100); color: var(--gray-900); text-decoration: none; }
.navbar-nav a.active { background: var(--primary); color: #fff; }
.navbar-user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--gray-600); }
.navbar-user .role-badge {
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

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

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 24px; font-weight: 700; }

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 16px;
}
.breadcrumbs a { color: var(--gray-500); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .separator { color: var(--gray-300); }

/* Cards */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-body { padding: 20px; }
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
}

/* Status cards (dashboard) */
.status-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.status-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: box-shadow 0.15s;
}
.status-card:hover { box-shadow: var(--shadow-md); }
.status-card a { color: inherit; text-decoration: none; display: block; }
.status-card .count { font-size: 36px; font-weight: 700; color: var(--primary); }
.status-card .label { font-size: 14px; color: var(--gray-500); margin-top: 4px; }
.status-card.not-created .count { color: var(--gray-400); }
.status-card.sent .count { color: var(--warning); }
.status-card.reviewed .count { color: var(--primary); }
.status-card.released .count { color: var(--success); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--gray-200); }
th { font-weight: 600; font-size: 13px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; background: var(--gray-50); }
tr:hover td { background: var(--gray-50); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: #fff; color: var(--gray-700); border-color: var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-group { display: flex; gap: 8px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 4px; color: var(--gray-700); }
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
select.form-control { appearance: auto; }
textarea.form-control { min-height: 80px; resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-inline { display: flex; gap: 12px; align-items: end; }
.form-inline .form-group { margin-bottom: 0; }

/* Alerts / Flashes */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert .close-btn { background: none; border: none; cursor: pointer; font-size: 18px; color: inherit; opacity: 0.5; }
.alert .close-btn:hover { opacity: 1; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-draft { background: var(--gray-100); color: var(--gray-600); }
.badge-sent { background: #fef3c7; color: #92400e; }
.badge-reviewed { background: #dbeafe; color: #1e40af; }
.badge-released { background: #dcfce7; color: #166534; }
.badge-leader { background: #ede9fe; color: #6d28d9; }
.badge-person { background: #e0f2fe; color: #0369a1; }
.badge-shr { background: #fce7f3; color: #be185d; }
.badge-both { background: var(--gray-100); color: var(--gray-600); }
.badge-inactive { background: #fef2f2; color: #991b1b; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
}
.empty-state h3 { font-size: 18px; color: var(--gray-700); margin-bottom: 8px; }
.empty-state p { margin-bottom: 16px; }

/* Weight indicator */
.weight-indicator {
    font-size: 14px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius);
    display: inline-block;
}
.weight-indicator.valid { background: #dcfce7; color: #166534; }
.weight-indicator.invalid { background: #fef2f2; color: #991b1b; }

/* Goal editor */
.goal-item {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.goal-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.goal-number {
    font-weight: 700;
    font-size: 14px;
    color: var(--gray-500);
    background: var(--gray-100);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Checkbox list */
.checkbox-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 8px; }
.checkbox-item { padding: 6px 8px; display: flex; align-items: center; gap: 8px; border-radius: 4px; }
.checkbox-item:hover { background: var(--gray-50); }
.checkbox-item label { cursor: pointer; font-size: 14px; flex: 1; }

/* Confirmation dialog */
.dialog-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100;
    align-items: center;
    justify-content: center;
}
.dialog-overlay.active { display: flex; }
.dialog {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.dialog h3 { margin-bottom: 8px; }
.dialog p { color: var(--gray-600); font-size: 14px; margin-bottom: 20px; }
.dialog .btn-group { justify-content: flex-end; }

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filter-bar select { min-width: 180px; }

/* Login page */
.login-container {
    max-width: 440px;
    margin: 80px auto;
}
.login-container h1 { text-align: center; margin-bottom: 8px; }
.login-container p { text-align: center; color: var(--gray-500); margin-bottom: 24px; }

/* Searchable select */
.search-select-wrapper { position: relative; }
.search-select-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
}
.search-select-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.search-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    max-height: 240px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    z-index: 10;
}
.search-select-dropdown.active { display: block; }
.search-select-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}
.search-select-option:hover { background: var(--gray-100); }
.search-select-option .dept { color: var(--gray-400); font-size: 12px; margin-left: 8px; }

/* Utility */
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 13px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
