/* CSS Reset for layout */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    height: 100% !important;
    overflow-x: hidden !important;
}

/* Main layout styles - Override Bootstrap */
.page {
    position: relative !important;
    display: flex !important;
    flex-direction: row !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sidebar {
    background-color: #f8f9fa !important;
    border-right: 1px solid #dee2e6 !important;
    width: 250px !important;
    flex-shrink: 0 !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    height: 100vh !important;
    overflow-y: auto !important;
    z-index: 1000 !important;
    transition: transform 0.3s ease-in-out !important;
}

.sidebar.collapsed {
    transform: translateX(-250px) !important;
}

main {
    flex: 1 !important;
    margin-left: 250px !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh !important;
    width: calc(100% - 250px) !important;
    transition: margin-left 0.3s ease-in-out, width 0.3s ease-in-out !important;
}

main.sidebar-collapsed {
    margin-left: 0 !important;
    width: 100% !important;
}

.top-row {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: 2px solid rgba(0,0,0,0.1);
    height: 65px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.top-row h1 {
    color: #ffffff;
    font-weight: 600;
    font-size: 1.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

/* Navigation styles */
.nav-scrollable {
    min-height: 100vh !important;
    width: 100% !important;
    padding: 1rem 0 !important;
}

.nav-item {
    padding: 0.25rem 0 !important;
    margin: 0 !important;
}

.nav-link {
    display: flex !important;
    align-items: center !important;
    color: #495057 !important;
    text-decoration: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.25rem !important;
    transition: all 0.2s !important;
    margin: 0.125rem 0.5rem !important;
}

.nav-link:hover {
    background-color: #e9ecef !important;
    color: #007bff !important;
    text-decoration: none !important;
}

.nav-link.active {
    background-color: #007bff !important;
    color: white !important;
}

/* Sidebar toggle button */
.btn-sidebar-toggle {
    background: transparent;
    border: none;
    color: white;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.btn-sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
    transform: scale(1.05);
}

.btn-sidebar-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
    border-radius: 0.25rem;
}

/* Card enhancements */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Compact spacing for forms */
.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-3:last-child {
    margin-bottom: 0 !important;
}

.form-text {
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

/* Jumbotron styles */
.jumbotron {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

/* Form styles */
.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

.btn-xs {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    line-height: 1.2;
}

/* Stack/Service selection styles */
.stack-selection-container {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    background-color: #f8f9fa;
}

.stack-item {
    margin-bottom: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    background-color: white;
    padding: 1rem;
    transition: all 0.2s ease;
    display: block;
    width: 100%;
}

.stack-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
}

.stack-item.selected {
    border-color: #007bff;
    background-color: #f8f9ff;
}

.stack-item:last-child {
    margin-bottom: 0;
}

.stack-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.stack-checkbox-wrapper {
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
}

.stack-label-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stack-label {
    font-weight: 600;
    font-size: 1.1rem;
    color: #495057;
    margin: 0;
    cursor: pointer;
}

.stack-services {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.service-controls {
    margin-bottom: 0.5rem;
}

.service-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-check {
    margin-bottom: 0;
    padding: 0.25rem 0;
}

.form-check-input {
    margin-top: 0.25rem;
}

/* Badge styles for stack states */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Log display */
pre {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 0;
}

/* Compact spacing fixes */
.container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

.row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.col-md-6 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Remove excessive spacing */
hr {
    margin: 1rem 0;
}

h2 {
    margin-bottom: 0.5rem;
}

/* Alert spacing */
.alert {
    margin-bottom: 1rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-250px) !important;
    }
    
    .sidebar.collapsed {
        transform: translateX(0) !important;
    }
    
    main {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    main.sidebar-collapsed {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .nav-scrollable {
        min-height: auto !important;
        padding: 0.5rem 0 !important;
    }
    
    .service-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Show overlay when sidebar is open on mobile */
    .sidebar:not(.collapsed)::before {
        content: '';
        position: fixed;
        top: 0;
        left: 250px;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
}

@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0) !important;
    }
}

/* Blazor error UI */
#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;
}