html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

a, .btn-link {
    color: #1976d2;
}

.btn-primary {
    color: #fff;
    background-color: #1976d2;
    border-color: #1976d2;
}

.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.sidebar {
    background-image: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
    width: 250px;
    position: relative;
}

/* Mobile: Hide sidebar by default */
@media (max-width: 640.98px) {
    .sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        height: 100vh;
        z-index: 999;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
        overflow-y: auto;
    }

    .sidebar.open {
        left: 0;
    }
}

.sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid transparent;
    color: #333;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Show hamburger menu on mobile */
@media (max-width: 640.98px) {
    .sidebar-toggle {
        display: flex;
    }
}

.sidebar-toggle:hover {
    color: #1976d2;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.sidebar-toggle:active {
    background-color: rgba(0, 0, 0, 0.1);
}

.top-row {
    background-color: #f7f7f7;
    border-bottom: 1px solid #d6d5d5;
    justify-content: flex-start;
    height: 3.5rem;
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

.top-row ::deep a, .top-row .btn-link {
    white-space: nowrap;
    margin-left: 1.5rem;
}

.top-row a:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640.98px) {
    .top-row:not(.auth) {
        display: none;
    }

    .top-row.auth {
        justify-content: flex-start;
    }

    .top-row a, .top-row .btn-link {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .top-row {
        position: sticky;
        top: 0;
        z-index: 997;
        background-color: #f7f7f7;
    }

    .top-row h3 {
        margin: 0;
        font-size: 1.2rem;
        flex: 1;
    }

    .page {
        flex-direction: column;
    }

    main {
        width: 100%;
    }
}

@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
        left: auto !important; /* Override mobile positioning */
    }

    .sidebar.open {
        left: auto !important; /* Override mobile open state */
    }

    .sidebar-toggle {
        display: none !important; /* Hide toggle on desktop */
    }

    .sidebar-overlay {
        display: none !important; /* Hide overlay on desktop */
    }

    .top-row {
        position: sticky;
        top: 0;
        z-index: 1;
    }

    main > div {
        padding-left: 2rem !important;
        padding-right: 1.5rem !important;
    }
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.content {
    padding-top: 1.1rem;
}

