@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --openimis-teal: #005f73;
    --openimis-teal-hover: #004d5e;
    --openimis-teal-light: #e6f2f5;
    
    --bg-main: #f4f6f8;
    --bg-card: #ffffff;
    
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --text-light: #ffffff;
    --text-light-muted: rgba(255, 255, 255, 0.7);
    
    --border-color: #e2e8f0;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    
    --transition-fast: all 0.2s ease-in-out;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Layout Container */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* openIMIS Header (Teal Bar) */
.navbar {
    background-color: var(--openimis-teal);
    height: 50px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-light);
}

.brand-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-text {
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: -0.2px;
}

.brand-text span {
    font-weight: 700;
}

.brand-version {
    font-size: 0.65rem;
    color: var(--text-light-muted);
    align-self: flex-start;
    margin-top: 0.25rem;
    font-weight: 500;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
}

.nav-menu-item {
    color: var(--text-light-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition-fast);
}

.nav-menu-item:hover, .nav-menu-item.active {
    color: var(--text-light);
    background-color: rgba(255, 255, 255, 0.08);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-right-item {
    color: var(--text-light-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.nav-right-item:hover {
    color: var(--text-light);
    background-color: rgba(255, 255, 255, 0.08);
}

.nav-icon-btn {
    color: var(--text-light-muted);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.nav-icon-btn:hover {
    color: var(--text-light);
    background-color: rgba(255, 255, 255, 0.08);
}

/* User Identity Tag */
.nav-user-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Main Canvas */
main {
    flex: 1;
    padding: 2.5rem 0;
}

/* Hero Section */
.hero {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.hero h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.hero p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Enterprise Panels/Cards */
.panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-title svg {
    color: var(--openimis-teal);
}

/* Card Grid for Landing Page */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.gateway-card {
    text-align: left;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.gateway-card-body p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-fast);
}

.btn-primary {
    background-color: var(--openimis-teal);
    color: var(--text-light);
}

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

.btn-secondary {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-danger {
    background-color: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

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

/* Dashboard Layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

/* Profile Card Widget */
.profile-widget {
    text-align: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background-color: var(--openimis-teal-light);
    border: 2px solid var(--openimis-teal);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--openimis-teal);
    margin: 0 auto 1rem;
}

.profile-widget h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-widget .email {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    word-break: break-all;
}

.profile-data-list {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.profile-data-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.profile-data-label {
    color: var(--text-muted);
}

.profile-data-val {
    font-weight: 600;
    color: var(--text-primary);
}

/* Tabs system */
.tab-header {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.tab-link {
    background: none;
    border: none;
    padding: 0.75rem 0.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    font-family: var(--font-sans);
    transition: var(--transition-fast);
}

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

.tab-link.active {
    color: var(--openimis-teal);
}

.tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--openimis-teal);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Data Tables & Lists */
.claims-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.claims-table th, .claims-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.claims-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #475569;
}

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

.claim-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 4px;
    font-family: var(--font-mono);
}

.claim-badge.badge-success {
    background-color: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
}

.claim-badge.badge-danger {
    background-color: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

/* JSON formatting */
pre {
    background-color: #1e293b;
    border-radius: 4px;
    padding: 1.25rem;
    overflow-x: auto;
}

code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #f1f5f9;
}

/* Footer styling */
footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    background-color: #ffffff;
    margin-top: auto;
}

footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

footer a {
    color: var(--openimis-teal);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

/* =========================================================
   App Switcher Dropdown
   ========================================================= */
.app-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.app-switcher-btn {
    /* Highlight when dropdown is open */
}
.app-switcher-btn[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.app-switcher-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 500;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
    min-width: 280px;
    overflow: hidden;
    /* Smooth slide-in animation */
    transform: translateY(-6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.18s ease, opacity 0.18s ease, visibility 0.18s ease;
}

.app-switcher-dropdown.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-switcher-header {
    padding: 0.65rem 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
}

.app-switcher-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.app-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
    position: relative;
    text-align: center;
}

/* Remove outer borders */
.app-tile:nth-child(2n) { border-right: none; }
.app-tile:nth-last-child(-n+2) { border-bottom: none; }

.app-tile:hover {
    background-color: var(--openimis-teal-light);
}

.app-tile.active {
    background-color: #eef9f7;
}

.app-tile-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background-color: var(--openimis-teal-light);
    border: 1px solid rgba(0, 95, 115, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--openimis-teal);
    transition: background-color 0.15s ease;
}

.app-tile:hover .app-tile-icon {
    background-color: var(--openimis-teal);
    color: #fff;
    border-color: transparent;
}

.app-tile.active .app-tile-icon {
    background-color: var(--openimis-teal);
    color: #fff;
    border-color: transparent;
}

.app-tile-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.app-tile-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background-color: var(--openimis-teal);
    color: #fff;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}
