:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --danger: #ef4444;
    --success: #10b981;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
}

* {
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--background);
    color: var(--text-main);
}

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

/* --- Sidebar Styles --- */
.sidebar {
    width: 280px;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
}

.sidebar-brand {
    padding: 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.logo-circle {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.4);
}

.logo-image {
    height: 34px;
    width: auto;
    display: block;
}

.sidebar-nav {
    padding: 1.5rem 1rem;
}

.nav-section {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    margin-top: 1.5rem;
    padding-left: 0.75rem;
}

.nav-section:first-child {
    margin-top: 0;
}

.nav-item-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-link {
    display: block;
    padding: 0.6rem 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link:focus {
    background-color: #f1f5f9;
    color: var(--primary-dark);
}

.nav-link.active {
    background-color: #e0f2fe;
    color: var(--primary-dark);
    font-weight: 600;
    border-left: 3px solid var(--primary);
    border-radius: 0 6px 6px 0;
    /* Flat left side because of the border */
}

/* --- Main Content Area --- */
.main-content {
    flex: 1;
    min-width: 0;
    /* Important for flex children containing large elements */
}

.view-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2.5rem;
}

/* Reusable UI Components */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

.card-title {
    margin-top: 0;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--background);
    padding-bottom: 0.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    color: white;
    transition: background-color 0.2s;
}

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

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

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

.btn-success {
    background: var(--success);
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 1rem;
}

/* Angular Validation Classes */
.form-control.ng-invalid.ng-touched {
    border-color: var(--danger);
}

.form-control.ng-valid.ng-touched {
    border-color: var(--success);
}

.error-text {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* Code Snippets & Diffs */
.diff-add {
    background-color: rgba(16, 185, 129, 0.2);
    display: block;
}

.diff-remove {
    background-color: rgba(239, 68, 68, 0.2);
    display: block;
}

.diff-info {
    color: #94a3b8;
    display: block;
    font-style: italic;
}

/* ============================
   Mobile Header & Hamburger
   ============================ */
.mobile-header {
    display: none;
    /* Hidden on desktop */
}

.sidebar-close-btn {
    display: none;
    /* Hidden on desktop */
}

.sidebar-backdrop {
    display: none;
    /* Hidden on desktop */
}

/* ============================
   Responsive Breakpoints
   ============================ */
@media (max-width: 768px) {

    /* -- Layout -- */
    .app-container {
        flex-direction: column;
    }

    /* -- Mobile Header Bar -- */
    .mobile-header {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.85rem 1rem;
        background: #ffffff;
        border-bottom: 1px solid #e2e8f0;
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    }

    .mobile-title {
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--text-main);
    }

    /* -- Hamburger Button -- */
    .hamburger-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 36px;
        height: 36px;
        padding: 6px;
        background: none;
        border: none;
        cursor: pointer;
        border-radius: 6px;
        transition: background 0.2s;
    }

    .hamburger-btn:hover {
        background-color: #f1f5f9;
    }

    .hamburger-btn span {
        display: block;
        width: 100%;
        height: 2.5px;
        background-color: var(--text-main);
        border-radius: 2px;
        transition: transform 0.3s, opacity 0.3s;
    }

    /* -- Sidebar as Drawer -- */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    /* -- Close Button -- */
    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        width: 32px;
        height: 32px;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-muted);
        cursor: pointer;
        border-radius: 6px;
        transition: background 0.2s, color 0.2s;
        line-height: 1;
    }

    .sidebar-close-btn:hover {
        background-color: #f1f5f9;
        color: var(--text-main);
    }

    /* -- Backdrop -- */
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 150;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-backdrop.visible {
        opacity: 1;
        pointer-events: auto;
    }

    /* -- Content Adjustments -- */
    .view-container {
        padding: 1.5rem 1rem;
    }

    .card {
        padding: 1.25rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .view-container {
        padding: 1rem 0.75rem;
    }

    .card {
        padding: 1rem;
        border-radius: 6px;
    }

    .sidebar-brand {
        padding: 1.25rem;
        font-size: 1.05rem;
    }

    .btn {
        padding: 0.6rem 0.85rem;
        font-size: 0.9rem;
        width: 100%;
    }

    .form-control {
        font-size: 16px;
        /* Prevents iOS zoom on input focus */
    }

    /* Better touch targets for nav links */
    .nav-link {
        padding: 0.75rem;
        font-size: 1rem;
    }
}
