/* Digital Identity & Records System - Enterprise Theme */
:root {
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-focus: #059669;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --primary: #059669;
    --primary-hover: #047857;
    --primary-light: #ecfdf5;
    --primary-border: #a7f3d0;

    --gold: #d97706;
    --gold-light: #fef3c7;
    --gold-border: #fde68a;

    --danger: #dc2626;
    --danger-light: #fee2e2;
    --danger-border: #fecaca;

    --info: #0284c7;
    --info-light: #e0f2fe;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);

    --sidebar-width: 260px;
    --header-height: 68px;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    transition: transform 0.25s ease;
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.brand-badge {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #059669, #047857);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 900;
    font-size: 18px;
    margin-right: 12px;
}

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

.brand-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

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

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    padding: 10px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    margin-bottom: 3px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.header-search {
    flex: 1;
    max-width: 480px;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 8px 14px 8px 36px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease;
}

.search-input:focus {
    border-color: var(--primary);
    background-color: #ffffff;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-light);
    pointer-events: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.locale-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #047857;
    color: #ffffff;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Page Body */
.page-content {
    padding: 28px;
    flex: 1;
}

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

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

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

/* Flash alerts */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success {
    background-color: var(--primary-light);
    border: 1px solid var(--primary-border);
    color: #065f46;
}

.alert-error {
    background-color: var(--danger-light);
    border: 1px solid var(--danger-border);
    color: #991b1b;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.metric-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.metric-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.metric-value.highlight-green {
    color: var(--primary);
}

.metric-value.highlight-red {
    color: var(--danger);
}

.metric-value.highlight-gold {
    color: var(--gold);
}

/* Content Cards */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

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

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

.card-body {
    padding: 20px;
}

/* Data Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13.5px;
}

.table th {
    background-color: #f1f5f9;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.2;
}

.badge-success {
    background-color: var(--primary-light);
    color: #065f46;
    border: 1px solid var(--primary-border);
}

.badge-warning {
    background-color: var(--gold-light);
    color: #92400e;
    border: 1px solid var(--gold-border);
}

.badge-danger {
    background-color: var(--danger-light);
    color: #991b1b;
    border: 1px solid var(--danger-border);
}

.badge-secondary {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid var(--border-color);
}

.badge-info {
    background-color: var(--info-light);
    color: #0369a1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

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

.btn-secondary {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: #f1f5f9;
    color: var(--text-primary);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* Form inputs */
.form-group {
    margin-bottom: 16px;
}

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

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #ffffff;
    font-size: 13.5px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

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

/* Tabs */
.tabs-nav {
    display: flex;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
    gap: 4px;
    padding: 0 20px;
    background-color: #f8fafc;
}

.tab-link {
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.tab-link:hover {
    color: var(--primary);
}

.tab-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background-color: #ffffff;
}

/* Modals & Popups */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-dialog {
    background: #ffffff;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.92) translateY(12px);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-dialog {
    transform: scale(1) translateY(0);
}

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

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.modal-close:hover {
    color: var(--danger);
    background-color: var(--danger-light);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

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

/* Global Fullscreen Loading Animation */
#globalLoadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

#globalLoadingOverlay.active {
    display: flex;
    opacity: 1;
}

.global-spinner-wrap {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.global-spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: #10b981;
    border-right-color: #f59e0b;
    animation: globalSpin 0.85s linear infinite;
}

.global-spinner-inner {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #059669, #047857);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 900;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
    animation: globalPulse 1.8s ease-in-out infinite;
}

.global-loading-title {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.global-loading-subtitle {
    color: #94a3b8;
    font-size: 12.5px;
    margin-top: -10px;
}

@keyframes globalSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes globalPulse {
    0%, 100% { transform: scale(0.94); opacity: 0.85; }
    50% { transform: scale(1.06); opacity: 1; }
}

/* Toast Notifications */
.modern-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: #ffffff;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.35);
    font-weight: 600;
    font-size: 13.5px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(30px);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modern-toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Credential Display Box in Modals */
.credential-display-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.credential-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.credential-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    font-family: monospace;
    letter-spacing: 0.5px;
}

/* Mobile responsive */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
    .menu-toggle-btn {
        display: block !important;
    }
}

.menu-toggle-btn {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    margin-right: 12px;
}
