@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1 {
    font-size: var(--text-5xl);
    font-family: var(--font-family-display);
    font-weight: 800;
    letter-spacing: -0.02em;
}

h2 {
    font-size: var(--text-4xl);
    font-family: var(--font-family-display);
    font-weight: 800;
}

h3 {
    font-size: var(--text-2xl);
    font-family: var(--font-family-display);
    font-weight: 800;
}

h4 {
    font-size: var(--text-lg);
    font-family: var(--font-family-header);
    font-weight: 700;
    text-transform: uppercase;
}

h5 {
    font-size: var(--text-sm);
    font-family: var(--font-family-header);
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: var(--space-4);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-primary-hover);
}

ul {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
}

input,
textarea,
select {
    font-family: inherit;
}

/* =========================================
   Application Shell Layout
   ========================================= */

#app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-family: var(--font-family-display);
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--text-primary);
    text-transform: uppercase;
}

.brand-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-2);
    overflow-y: auto;
}

.nav-group {
    margin-bottom: var(--space-6);
}

.nav-group-title {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0 var(--space-2);
    margin-bottom: var(--space-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 2px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.nav-item:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--accent-primary-alpha);
    color: var(--accent-primary);
    font-weight: 500;
}

.nav-item i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

.user-profile-mini {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

.user-profile-mini:hover {
    background-color: var(--bg-surface-hover);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background-color: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.user-role {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* Main Content Area */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Important for flex child truncation */
}

/* Top Header */
.app-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    background-color: var(--bg-base);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 5;
}

.header-search {
    display: flex;
    align-items: center;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 0 var(--space-3);
    width: 300px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.header-search:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary-alpha);
}

.header-search i {
    color: var(--text-muted);
}

.header-search input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: var(--space-2);
    width: 100%;
    outline: none;
    font-size: var(--text-sm);
}

.header-search input::placeholder {
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.icon-button {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.icon-button:hover {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

.badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background-color: var(--accent-danger);
    border-radius: var(--radius-full);
}

/* View Container */
#view-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-6);
    position: relative;
}

/* Page Headers (common in views) */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: 600;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
}

.page-actions {
    display: flex;
    gap: var(--space-3);
}

/* Utility Classes */
.text-accent {
    color: var(--accent-primary);
}

.text-success {
    color: var(--accent-success);
}

.text-warning {
    color: var(--accent-warning);
}

.text-danger {
    color: var(--accent-danger);
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}