/* ============================================
   FCS Case VFP - Admin Dashboard Styles
   Modern Responsive Foster Care Management
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #161822;
    --bg-card: #1c1e2e;
    --bg-card-hover: #222438;
    --bg-sidebar: #12141e;
    --bg-input: #1a1c2a;
    --border-color: #2a2d3e;
    --border-light: #333650;
    --text-primary: #e8eaf0;
    --text-secondary: #8b8fa7;
    --text-muted: #5c6078;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-soft: rgba(99, 102, 241, 0.12);
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.12);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.12);
    --info: #06b6d4;
    --info-soft: rgba(6, 182, 212, 0.12);
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow: 0 4px 24px rgba(0,0,0,0.25);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ LIGHT THEME ============ */
[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #e8eaed;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fa;
    --bg-sidebar: #ffffff;
    --bg-input: #f5f6f8;
    --border-color: #e0e3e8;
    --border-light: #ccd0d8;
    --text-primary: #1a1d26;
    --text-secondary: #4a5068;
    --text-muted: #8891a5;
    --accent: #5b5fc7;
    --accent-hover: #4f46e5;
    --accent-soft: rgba(91, 95, 199, 0.1);
    --success-soft: rgba(34, 197, 94, 0.1);
    --warning-soft: rgba(245, 158, 11, 0.1);
    --danger-soft: rgba(239, 68, 68, 0.1);
    --info-soft: rgba(6, 182, 212, 0.1);
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
}

[data-theme="light"] .sidebar {
    background: #12141e;
    border-right-color: #2a2d3e;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
}

[data-theme="light"] .sidebar-brand {
    border-bottom-color: #2a2d3e;
}

[data-theme="light"] .sidebar-brand-text {
    color: #e8eaf0;
}

[data-theme="light"] .sidebar-brand-text small {
    color: #5c6078;
}

[data-theme="light"] .sidebar-section-title {
    color: #5c6078;
}

[data-theme="light"] .sidebar .nav-link {
    color: #8b8fa7;
}

[data-theme="light"] .sidebar .nav-link:hover {
    background: #1c1e2e;
    color: #e8eaf0;
}

[data-theme="light"] .sidebar .nav-link.active {
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
}

[data-theme="light"] .sidebar-footer {
    border-top-color: #2a2d3e;
}

[data-theme="light"] .sidebar-footer .nav-link {
    color: #8b8fa7;
}

[data-theme="light"] .sidebar-footer .nav-link:hover {
    color: #e8eaf0;
}

[data-theme="light"] .sidebar .versionNo {
    color: #5c6078;
}

[data-theme="light"] .top-header {
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

[data-theme="light"] select.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%234a5068' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
}

/* Theme icon visibility */
[data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: block; }
[data-theme="light"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: block; }

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

html { font-size: 15px; }

body {
    font-family: 'DM Sans', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition);
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px; color: #fff;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-weight: 700; font-size: 16px;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-brand-text small {
    font-weight: 400; font-size: 11px;
    color: var(--text-muted);
    display: block; margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 0 8px;
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

.nav-link svg {
    width: 20px; height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-link.active svg, .nav-link:hover svg { opacity: 1; }

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
}

/* ============ MAIN CONTENT ============ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin var(--transition);
    display: flex;
    flex-direction: column;
}

/* ============ TOP HEADER BAR ============ */
.top-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    gap: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.top-header-left {
    flex: 1;
    min-width: 0;
}

.top-header-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Theme Toggle */
.theme-toggle {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.theme-toggle:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-hover);
}

.theme-toggle svg {
    flex-shrink: 0;
}

/* Notification Bell */
.notification-bell {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
}

.notification-bell:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-hover);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 0 0 2px var(--bg-card);
    animation: bellPulse 2s ease-in-out infinite;
}

@keyframes bellPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: var(--radius-sm);
    margin-left: 4px;
    border: 1px solid var(--border-color);
    transition: all var(--transition);
}

.user-info:hover {
    background: var(--bg-card-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.page-header {
    padding: 28px 32px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.page-body { padding: 0 32px 32px; }

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition);
}

.card:hover { border-color: var(--border-light); }

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h5, .card-header h6 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.card-body { padding: 22px; }

/* ============ STAT CARDS ============ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}

.stat-icon.blue { background: var(--accent-soft); color: var(--accent); }
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.yellow { background: var(--warning-soft); color: var(--warning); }
.stat-icon.red { background: var(--danger-soft); color: var(--danger); }
.stat-icon.cyan { background: var(--info-soft); color: var(--info); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
    font-family: 'JetBrains Mono', monospace;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============ TABLES ============ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

table tbody tr { transition: background var(--transition); }
table tbody tr:hover { background: var(--bg-card-hover); }
table tbody tr:last-child td { border-bottom: none; }

/* ============ BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--accent-soft); color: var(--accent-hover); }
.badge-muted { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }

.btn-warning { background: var(--warning); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent-hover);
    background: var(--accent-soft);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 8px; font-size: 12px; }

.btn-icon {
    width: 36px; height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ============ FORMS ============ */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control, .form-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: border-color var(--transition);
    outline: none;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-control::placeholder { color: var(--text-muted); }

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

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.form-check input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.form-check label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.form-inline {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.form-inline .form-group { flex: 1; margin-bottom: 0; }

select.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b8fa7' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ============ ALERTS ============ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.alert-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert-info { background: var(--info-soft); color: var(--info); border: 1px solid rgba(6,182,212,0.2); }

/* ============ MODAL ============ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    box-shadow: var(--shadow);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h5 { font-size: 16px; font-weight: 600; margin: 0; }

.modal-close {
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    padding: 4px; font-size: 20px;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============ TABS ============ */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    gap: 0;
    overflow-x: auto;
}

.tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
    cursor: pointer;
    background: none; border-left: none; border-right: none; border-top: none;
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-hover); border-bottom-color: var(--accent); }

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 15px; margin-bottom: 16px; }

/* ============ MOBILE ============ */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 1100;
    width: 44px; height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center; justify-content: center;
}

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: flex; }
    .top-header { padding: 0 16px 0 60px; }
    .page-header { padding: 20px 16px 16px; }
    .page-body { padding: 0 16px 24px; }
    .stat-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .user-details { display: none; }
}

@media (max-width: 640px) {
    html { font-size: 14px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 22px; }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .card-body { padding: 16px; }
}

/* ============ LOGIN PAGE ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow);
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-brand .sidebar-brand-icon {
    width: 56px; height: 56px;
    font-size: 24px;
    margin: 0 auto 16px;
}

.login-brand h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-brand p {
    color: var(--text-muted);
    font-size: 14px;
}

.login-card .form-group { margin-bottom: 20px; }
.login-card .btn-primary { width: 100%; padding: 12px; font-size: 15px; }

/* ============ UTILITY ============ */
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-3 { margin-top: 16px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.w-100 { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
}

/* ============ SECTION CARDS ============ */
.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .section-grid { grid-template-columns: 1fr; }
}

/* ============ ACTIONS ============ */
.action-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ============ PILL NAV ============ */
.pill-nav {
    display: flex;
    gap: 6px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.pill-nav a, .pill-nav button {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    transition: all var(--transition);
}

.pill-nav a:hover, .pill-nav button:hover { color: var(--text-primary); }

.pill-nav a.active, .pill-nav button.active {
    background: var(--accent);
    color: #fff;
}

/* ============ DETAIL PANELS ============ */
.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.detail-avatar {
    width: 64px; height: 64px;
    border-radius: var(--radius-lg);
    background: var(--accent-soft);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
    overflow: hidden;
}

.detail-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.detail-info h2 { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.detail-info p { color: var(--text-muted); font-size: 13px; }

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

.meta-item label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.meta-item span {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}
.detail-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}
.detail-value a {
    color: var(--accent);
    text-decoration: none;
}
.detail-value a:hover {
    text-decoration: underline;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 1.5rem;
}
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-grid .form-group[style*="grid-column: span 2"] {
        grid-column: span 1 !important;
    }
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

/* Button Group */
.btn-group {
    display: flex;
    gap: 0.375rem;
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Text Utilities */
.text-center {
    text-align: center;
}
.text-danger {
    color: var(--danger) !important;
    font-size: 0.8rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
}
.tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all 0.2s;
}
.tab:hover {
    color: var(--text-primary);
    background: var(--surface-secondary);
}
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.tab-content {
    display: none;
    padding-top: 1.5rem;
}
.tab-content.active {
    display: block;
}

/* Small button variant */
.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Danger button */
.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: opacity 0.2s;
}
.btn-danger:hover {
    opacity: 0.85;
}

.versionNo {
    padding-left: 14px;
    font-size: 10px;
    color: #d3d3d3;
}

/* Responsive detail grid on response page */
@media (max-width: 768px) {
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* ============ APP FOOTER ============ */
.app-footer {
    margin-top: auto;
    padding: 24px 32px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.footer-copy {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-links a {
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--accent-hover);
}

.footer-dot {
    color: var(--text-muted);
    font-size: 12px;
    user-select: none;
}

@media (max-width: 640px) {
    .app-footer { padding: 20px 16px; }
}
