:root {
    /* Light Mode (Jira-like) */
    --bg-body: #ffffff;
    --bg-sidebar: #f4f5f7;
    --bg-surface: #ffffff;
    --text-primary: #172b4d;
    --text-secondary: #6b778c;
    --border-color: #dfe1e6;
    --primary-color: #0052cc;
    --primary-hover: #0065ff;
    --sidebar-width: 260px;
    --header-height: 60px;
    --transition-speed: 0.3s;
    --shadow-sm: 0 1px 2px rgba(9, 30, 66, 0.25);
    --shadow-md: 0 3px 6px rgba(9, 30, 66, 0.25);
}

[data-theme="dark"] {
    /* Dark Mode (Jira Dark) */
    --bg-body: #1d2125;
    --bg-sidebar: #161a1d;
    --bg-surface: #22272b;
    --text-primary: #9fadbc;
    --text-secondary: #8c9bab;
    --border-color: #2c333a;
    --primary-color: #579dff;
    --primary-hover: #85b8ff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 3px 6px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    /* App-like feel */
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    flex-shrink: 0;
    overflow-y: auto;
    transition: transform var(--transition-speed), background-color var(--transition-speed);
    z-index: 1000;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
    letter-spacing: 0.04em;
}

.nav-item {
    display: block;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 2px;
    transition: background-color 0.1s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-item:hover,
.nav-item.active {
    background-color: rgba(140, 155, 171, 0.15);
    /* Subtle hover */
    color: var(--primary-color);
    text-decoration: none;
}

.nav-item i {
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.nav-item:hover i,
.nav-item.active i {
    color: var(--primary-color);
}


/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-body);
    width: 100%;
    /* Ensure full width */
}

.top-bar {
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Changed for mobile toggle */
    padding: 0 1.5rem;
    background-color: var(--bg-body);
    flex-shrink: 0;
}

.content-area {
    padding: 2rem;
    overflow-y: auto;
    height: calc(100% - var(--header-height));
}

/* UI Elements */

/* Cards */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.25rem;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    border-radius: 4px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-outline-secondary {
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-outline-secondary:hover {
    background-color: rgba(140, 155, 171, 0.1);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Forms */
.form-control,
.form-select {
    background-color: var(--bg-body);
    border-color: var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-body);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.2);
    color: var(--text-primary);
}

/* Tables */
.table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
    /* Override Bootstrap */
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.table tbody td {
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(140, 155, 171, 0.08);
    /* Hover effect compatible with both modes */
    color: var(--text-primary);
}

/* Utilities */
.text-muted {
    color: var(--text-secondary) !important;
}

.text-dark {
    color: var(--text-primary) !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(140, 155, 171, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(140, 155, 171, 0.6);
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.theme-toggle-btn:hover {
    background-color: rgba(140, 155, 171, 0.15);
}

/* Mobile Responsiveness */
.mobile-toggle-btn {
    display: none;
    /* Hidden by default on desktop */
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    padding: 0;
    margin-right: 1rem;
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.show {
    opacity: 1;
}

@media (max-width: 768px) {
    .app-sidebar {
        position: fixed;
        left: calc(var(--sidebar-width) * -1);
        /* Hide off-screen */
        height: 100vh;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .app-sidebar.show {
        transform: translateX(var(--sidebar-width));
    }

    .mobile-toggle-btn {
        display: block;
    }

    .sidebar-overlay {
        display: block;
        /* But likely invisible until .show is added */
        pointer-events: none;
        /* Allow clicks through when not showing */
    }

    .sidebar-overlay.show {
        pointer-events: auto;
    }

    .content-area {
        padding: 1rem;
        /* Reduce padding on mobile */
    }

    .top-bar {
        padding: 0 1rem;
    }
}