/* static/css/layout.css */

/* NEW: Styles for the permanent page header */
.page-header {
    grid-column: 1; /* Place in the first column */
    grid-row: 1;    /* Place in the first row */
    /*padding: 2.5rem;  Give it space from the edges */
    /* Center the logo within its grid cell */
    display: flex;
    justify-content: center;
    align-items: center;
}
.page-header .logo {
    max-width: 25px;
    height: auto;
}

/* ==========================================================================
   DASHBOARD PAGE LAYOUT
   ========================================================================== */

/* Main Content Area Adjustment */
.dashboard-page-body .content-box {
    margin: 2.5rem;
    margin-top: calc(60px + 2.5rem);
    transition: margin-left 0.3s ease-in-out;
    margin-left: 2.5rem;
}

.dashboard-page-body.sidebar-is-active .content-box {
    margin-left: calc(250px + 2.5rem);
}

.content-main {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2.5rem;
}

/* ==========================================================================
   LOGIN PAGE STYLES
   ========================================================================== */

.login-page-body {
    background:
        linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
        url('../images/login_bck_white_blue_gold.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-page-body .login-container {
    background-color: var(--card-background);
    padding: 2.5em;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-page-body .logo {
    max-width: 100%;
    width: 250px;
    height: auto;
    margin-bottom: 1em;
}

.login-page-body h2 {
    font-family: var(--font-heading);
    font-size: 1.5em;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1.5em;
    color: var(--text-color);
}

.login-page-body .form-group { margin-bottom: 1.5em; text-align: left; }
.login-page-body label { font-family: var(--font-heading); display: block; margin-bottom: 0.5em; font-weight: 500; }
.login-page-body input[type="text"], .login-page-body input[type="password"] { width: 100%; padding: 0.8em; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; font-family: var(--font-body); }
.login-page-body .extra-links { margin-top: 1.5em; font-size: 0.9em; }
.login-page-body .errorlist { list-style-type: none; padding: 0; margin: 0 0 1em 0; color: #d9534f; font-weight: 500; }


/* ==========================================================================
   DASHBOARD STYLES
   ========================================================================== */

.dashboard-page-body {
    display: grid; /* Use grid instead of flexbox */
    grid-template-columns: auto 1fr; /* A narrow first column for the logo, the second fills the rest */
    grid-template-rows: auto 1fr;    /* A short first row for the logo, the second fills the rest */
    min-height: 100vh;
    background-color: var(--dashboard-bg);
    box-sizing: border-box;
    padding: 0.5rem; /* ADD: Creates the outer margin for the whole layout */
    /* gap: 1rem;     ADD: Creates the space between the logo and the content box */
}


.dashboard-page-body .content-box {
    grid-column: 2; /* Place in the second column */
    grid-row: 2;    /* Place in the second row */

    /* The rest of the properties are the same */
    background-color: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/**
.dashboard-page-body .content-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-page-body .logo {
    max-width: 20px;
    margin: 0;
}
**/

.dashboard-page-body .content-main {
    padding: 2.5rem;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.dashboard-wrapper {
}

.dashboard-page-body .content-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.dashboard-page-body .content-footer a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
}

.dashboard-page-body h1 {
    font-family: var(--font-heading);
    margin-top: 0;
    font-size: 1.5rem;
}


.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 30px; }

/* ==========================================================================
   PROJECT DETAIL PAGE STYLES
   ========================================================================== */

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-layout {
    display: flex;
    gap: 2.5rem;
    margin-top: 1.5rem;
}

.project-sidebar {
    flex-basis: 30%;
    background-color: #f9fafb;
    border-radius: 8px;
    padding: 1.5rem;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    font-size: 14px; /* Set a smaller base font size */
}

.project-main-content {
    flex-grow: 1;
    font-size: 14px; /* Set a smaller base font size */
}

.admin-grid-3-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    align-items: start;
}

.grid-span-2 {
    grid-column: span 2;
}

.results-grid-container {
  display: grid;
  gap: 24px; /* Adjust the spacing between items as needed */
  padding-top: 20px;
}

.view-last-run-container {
    margin-top: auto;
    padding-top: 1rem;
    align-self: flex-end;
}



/* ==========================================================================
   RESULTS DASHBOARD COMPONENT STYLES
   ========================================================================== */

.results-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
  padding-top: 20px;
}

.grid-span-2 {
    grid-column: span 2;
}

/* ==========================================================================
   DASHBOARD SIDEBAR & FOOTER STYLES
   ========================================================================== */

/* --- New Footer Layout --- */
.dashboard-page-body .content-footer {
    display: flex;
    justify-content: space-between; /* Pushes items to opposite ends */
    align-items: center;
}

/* Teammate list */
.teammate-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}
.teammate-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9em;
}

/* ==========================================================================
   RESPONSIVE STYLES (for mobile)
   ========================================================================== */

/* This rule applies only when the screen is 768px wide or less */
@media (max-width: 768px) {

    /* Change the two-column project layout to a single column */
    .project-layout {
        flex-direction: column; /* Stack the sidebar and main content vertically */
    }

    /* Reduce the large margins on the main content box for smaller screens */
    .dashboard-page-body .content-box {
        margin: 1rem;
    }

    /* Make the login box take up more screen width */
    .login-page-body .login-container {
        padding: 2em;
        margin: 1rem;
    }
}


/* ==========================================================================
   ADMIN & DATA TABLE STYLES
   ========================================================================== */



/* --- Admin Management Page Layout --- */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    overflow: visible;
}

@media (min-width: 992px) {
    .admin-grid {
        grid-template-columns: repeat(2, 1fr);
        align-items: flex-start;
        overflow: visible;
    }
}

.form-grid {
    display: grid;
    gap: 1.5rem;
    padding: 1rem 0;
}

.form-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

.action-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-form {
    margin: 0;
    display: contents;
}

/* --- Message/Alert Styles --- */
.messages {
    padding: 0 1rem;
    margin-bottom: 1rem;
}

/* --- Job Monitoring Filter Form Styles --- */
.filter-form {
    padding: 1rem 1rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex; /* This makes the items go in a row */
    flex-wrap: wrap; /* Allows wrapping on small screens */
    align-items: flex-end; /* Aligns items to the bottom */
    gap: 1rem;
}

.filter-form .form-group {
    /* Don't let form groups grow too much, which causes wrapping */
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 180px; /* Give each filter a minimum width */
}

/* Specific group for buttons */
.filter-form .form-actions {
    margin-left: auto; /* Pushes buttons to the far right */
    display: flex;
    gap: 0.5rem;
}

/* --- Admin Dashboard KPI Styles --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

/* --- Admin Form Container Styles --- */
.form-container {
    max-width: 600px; /* Constrain the width of the form for readability */
}

/* ==========================================================================
   ADMIN PANELS & BUILDER STYLES
   ========================================================================== */

/* Layout grids for multi-column pages */
.admin-grid, .builder-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}
@media (min-width: 992px) {
    .admin-grid, .builder-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.admin-grid > .content-panel {
    overflow: visible;
}


/* ==========================================================================
   GENERIC COMPONENTS & FORMS
   ========================================================================== */
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.form-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: right;
}
.form-container { max-width: 700px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}