/* Mobile-first approach - remove fixed heights that prevent scrolling */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    /* Removed fixed height: 100% to allow natural scrolling */
}

body {
    margin: 0;
    padding: 0;
    /* Changed from min-height: 100vh to allow proper mobile scrolling */
    /* Removed overflow-x: hidden to prevent conflicts */
    -webkit-overflow-scrolling: touch;
    /* Use natural height instead of fixed viewport height */
}

/* Main app container - allow natural document flow */
app {
    display: flex;
    flex-direction: column;
    /* Changed from min-height: 100vh to allow content to dictate height */
    min-height: 100vh;
    width: 100%;
    /* Ensure app container doesn't restrict scrolling */
}

/* Fix for vertically stretched cards ONLY in dashboard and list contexts */
.dashboard .card.h-100,
.dashboard-container .card.h-100,
.list-view-container .card.h-100 {
    height: auto !important;
    min-height: auto !important;
}

/* Improve card layouts to prevent stretching ONLY in specific contexts */
.dashboard .row .card,
.dashboard-container .row .card,
.list-view-container .row .card,
.list-card-grid .row .card {
    height: auto;
    min-height: fit-content;
    display: flex;
    flex-direction: column;
}

/* Ensure card body grows properly without forcing height - LIMITED SCOPE */
.dashboard .card-body,
.dashboard-container .card-body,
.list-view-container .card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Fix for Bootstrap grid cards that force equal height - LIMITED SCOPE */
.dashboard .row [class*="col-"] .card,
.dashboard-container .row [class*="col-"] .card,
.list-view-container .row [class*="col-"] .card {
    height: auto !important;
    min-height: auto !important;
}

/* Specific fixes for common card patterns - LIMITED SCOPE */
.dashboard .card-grid .card,
.dashboard-container .card-grid .card,
.list-card-grid .card,
.template-card,
.form-card {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}

/* ENSURE NORMAL BEHAVIOR FOR OTHER PAGES */
/* These rules ensure that pages outside of dashboard/list contexts behave normally */
.container-fluid:not(.dashboard-container):not(.list-view-container) .card {
    /* Allow normal Bootstrap card behavior */
    height: auto;
    min-height: auto;
    display: block; /* Normal display instead of flex */
}

.container-fluid:not(.dashboard-container):not(.list-view-container) .card-body {
    /* Normal card body behavior */
    display: block;
    flex-grow: unset;
}

/* Specific fixes for submission and form pages */
#submission-content .card,
.submission-review .card,
.interview-form .card,
.form-review .card,
.form-edit-container .card,
.form-details-container .card {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    display: block !important;
}

#submission-content .card-body,
.submission-review .card-body,
.interview-form .card-body,
.form-review .card-body,
.form-edit-container .card-body,
.form-details-container .card-body {
    display: block !important;
    flex-grow: unset !important;
    flex-direction: unset !important;
}

.header-logo {
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask: url('../images/Logo.svg');
    mask: url('../images/Logo.svg');
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    width: 130px;
    height: 24px;
}

/* Enhanced navbar brand styling for better UX */
.navbar-brand {
    transition: all 0.2s ease-in-out;
    text-decoration: none !important;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
}

.navbar-brand:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    text-decoration: none !important;
    color: rgba(255, 255, 255, 0.95) !important;
}

.navbar-brand:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
    text-decoration: none !important;
}

.navbar-brand:active {
    transform: translateY(0);
    background-color: rgba(255, 255, 255, 0.15);
}

/* Ensure icon stays properly aligned */
.navbar-brand i {
    transition: transform 0.2s ease-in-out;
}

.navbar-brand:hover i {
    transform: scale(1.05);
}

#blazor-error-ui {
    background: inherit;
    bottom: 0;
    display: none;
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: 100001;
}

/* Centered Modal Utility Classes */
.modal-centered {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 15px;
    box-sizing: border-box;
}

.modal-dialog-centered {
    margin: 0 !important;
    max-height: calc(100vh - 30px);
    width: 100%;
    display: flex;
    flex-direction: column;
}

.modal-content-centered {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header-centered {
    flex-shrink: 0;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.modal-body-centered {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-height: 0;
}

.modal-footer-centered {
    flex-shrink: 0;
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

/* Responsive adjustments for small screens */
@media (max-width: 576px) {
    .modal-centered {
        padding: 10px;
    }
    
    .modal-dialog-centered {
        max-height: calc(100vh - 20px);
    }
    
    .modal-header-centered,
    .modal-body-centered,
    .modal-footer-centered {
        padding: 15px;
    }
}
