/* FRA Compliance Dashboard - Styles matching RDWF Global Dashboard */
:root {
    --primary: #0972d3;
    --success: #037f0c;
    --warning: #8a6116;
    --error: #d91515;
    --bg: #ffffff;
    --card: #ffffff;
    --text: #16191f;
    --text-secondary: #5f6b7a;
    --border: #e9ebed;
    --hover: #f2f3f3;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Amazon Ember', -apple-system, BlinkMacSystemFont, sans-serif; background: #f2f3f3; color: var(--text); min-height: 100vh; font-size: 14px; }

/* Header */
.header { background: #232f3e; padding: 16px 32px; display: flex; justify-content: space-between; align-items: center; }
.header h1 { font-size: 20px; color: #fff; font-weight: 700; }
.header .meta { font-size: 13px; color: #aab7c4; margin-top: 4px; }
.header-actions { display: flex; align-items: center; gap: 16px; }

/* Container */
.container { max-width: 1600px; margin: 0 auto; padding: 24px; }

/* Enhanced Filter Bar */
.filter-bar { margin-bottom: 24px; background: var(--card); padding: 16px 20px; border-radius: 8px; border: 1px solid var(--border); }
.filter-row { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.filter-group select { padding: 8px 32px 8px 12px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px; min-width: 180px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235f6b7a' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center; -webkit-appearance: none; cursor: pointer; }
.filter-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.filter-actions { margin-left: auto; }
.filter-actions label { visibility: hidden; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); padding: 8px 16px; border-radius: 4px; font-size: 14px; cursor: pointer; font-weight: 500; transition: all 0.2s; }
.btn-outline:hover { background: var(--primary); color: #fff; }

/* Compliance Summary */
.compliance-summary { display: grid; grid-template-columns: 280px 1fr; gap: 24px; margin-bottom: 24px; background: var(--card); padding: 24px; border-radius: 8px; border: 1px solid var(--border); }
.compliance-summary h3 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 16px; }

/* Donut Chart */
.donut-chart { position: relative; width: 180px; height: 180px; margin: 0 auto; }
.circular-chart { display: block; width: 100%; height: 100%; }
.circle-bg { fill: none; stroke: #e9ebed; stroke-width: 3.8; }
.circle { fill: none; stroke-width: 3.8; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray 0.5s ease; }
.circle.compliant { stroke: var(--success); }
.circle.exempt { stroke: #5f6b7a; }
.donut-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.donut-pct { display: block; font-size: 36px; font-weight: 700; color: var(--success); }
.donut-label { display: block; font-size: 12px; color: var(--text-secondary); }
.legend { display: flex; justify-content: center; gap: 24px; margin-top: 16px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.compliant { background: var(--success); }
.dot.exempt { background: #5f6b7a; }

/* Site Bars */
.site-bars { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.site-bar-row { display: grid; grid-template-columns: 60px 1fr 50px; align-items: center; gap: 12px; }
.site-name { font-size: 12px; font-weight: 500; color: var(--text); }
.site-bar { height: 16px; background: #e9ebed; border-radius: 2px; overflow: hidden; }
.site-bar-fill { height: 100%; background: linear-gradient(90deg, var(--success) 0%, #2ea043 100%); transition: width 0.5s ease; }
.site-pct { font-size: 12px; color: var(--text-secondary); text-align: right; }

/* Tabs */
.tabs-container { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.tabs { display: flex; gap: 0; background: var(--card); border-radius: 4px; border: 1px solid var(--border); overflow: hidden; }
.tab { padding: 10px 20px; font-size: 14px; font-weight: 500; background: transparent; border: none; color: var(--primary); cursor: pointer; border-right: 1px solid var(--border); }
.tab:last-child { border-right: none; }
.tab:hover { background: var(--hover); }
.tab.active { background: var(--primary); color: #fff; }
.tabs-right { display: flex; gap: 8px; }
.tab-drill { padding: 8px 16px; font-size: 13px; background: var(--card); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; color: var(--text); }
.tab-drill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Table Card */
.table-card { background: var(--card); border-radius: 8px; border: 1px solid var(--border); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; }
.card-header h2 { font-size: 16px; font-weight: 600; color: var(--text); }
.card-header .meta { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.table-actions { display: flex; gap: 12px; align-items: center; }
.search-input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px; width: 220px; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 12px; font-weight: 600; color: var(--text-secondary); background: #fafafa; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #f0f0f0; }
.sort-icon { font-size: 10px; margin-left: 4px; opacity: 0.3; }
.sort-icon.active { opacity: 1; color: var(--primary); }
tr:hover { background: var(--hover); }
td a { color: var(--primary); text-decoration: none; }
td a:hover { text-decoration: underline; }
.external-link { font-size: 11px; color: var(--text-secondary); margin-left: 4px; }

/* Badges */
.badge { display: inline-block; padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.badge.compliant { background: #e3f8e5; color: var(--success); }
.badge.exempt { background: #f0f0f0; color: #5f6b7a; }
.badge.overdue, .badge.never-completed { background: #fce8e8; color: var(--error); }
.badge.warning { background: #fef3e0; color: var(--warning); }
.badge.yes { background: #e3f8e5; color: var(--success); }
.badge.no { background: #fce8e8; color: var(--error); }
.badge.noncompliant { background: #fce8e8; color: var(--error); }

/* Pagination */
.table-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: #fafafa; }
.pagination-info { font-size: 13px; color: var(--text-secondary); }
.pagination { display: flex; gap: 4px; align-items: center; }
.page-btn, .page-num { padding: 6px 12px; border: 1px solid var(--border); background: #fff; border-radius: 4px; font-size: 13px; cursor: pointer; }
.page-btn:hover, .page-num:hover { background: var(--hover); }
.page-num.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Buttons */
.btn { padding: 8px 16px; border-radius: 4px; font-size: 14px; cursor: pointer; border: none; font-weight: 500; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--hover); }

/* Text colors */
.text-error { color: var(--error); font-weight: 500; }
.text-warning { color: var(--warning); font-weight: 500; }
.text-success { color: var(--success); }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-secondary); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { text-align: center; padding: 40px; color: var(--text-secondary); }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: none; justify-content: center; align-items: flex-start; padding: 40px; overflow-y: auto; z-index: 1000; }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: 8px; width: 100%; max-width: 1200px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; }
.modal-header h2 { font-size: 18px; font-weight: 600; }
.modal-header .meta { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.close-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-secondary); padding: 4px 8px; }
.close-btn:hover { color: var(--text); }
.modal-body { padding: 24px; }
.modal-section { margin-bottom: 24px; }
.modal-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--text); }

/* Alerts in Modal */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; line-height: 1.5; }
.alert.warning { background: #fef3e0; border-left: 4px solid var(--warning); color: #7a5a10; }
.alert.info { background: #e8f4fc; border-left: 4px solid var(--primary); color: #0a5a8c; }
.alert.success { background: #e3f8e5; border-left: 4px solid var(--success); color: #037f0c; }
.alert.error { background: #fce8e8; border-left: 4px solid var(--error); color: #d91515; }

/* Mini Tables */
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th, .mini-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.mini-table th { background: #fafafa; font-weight: 600; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.active { background: var(--success); }
.status-dot.inactive { background: var(--text-secondary); }

/* Drills Section */
.drills-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.drill-tabs { display: flex; gap: 8px; }
.drill-tab { padding: 6px 16px; font-size: 13px; border: 1px solid var(--border); border-radius: 4px; background: #fff; cursor: pointer; }
.drill-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.drills-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.drills-table th, .drills-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.drills-table th { background: #fafafa; font-weight: 600; white-space: nowrap; }

/* Responsive */
@media (max-width: 1400px) {
    .filter-group select { min-width: 160px; }
}
@media (max-width: 1200px) {
    .compliance-summary { grid-template-columns: 1fr; }
    .summary-left { border-bottom: 1px solid var(--border); padding-bottom: 24px; }
    .filter-group select { min-width: 140px; }
    .tabs-container { flex-direction: column; gap: 12px; align-items: stretch; }
    .table-actions { flex-direction: column; align-items: stretch; }
    .search-input { width: 100%; }
}
@media (max-width: 900px) {
    .filter-row { flex-direction: column; align-items: stretch; }
    .filter-group select { min-width: 100%; }
    .filter-actions { margin-left: 0; }
}
