﻿/*
================================================================
  DEFINITIVE, CLEAN LAYOUT STYLESHEET (FINAL)
================================================================
*/

/* --- 1. GLOBAL VARIABLES & BODY --- */
:root {
    --primary-blue: #4A90E2;
    --active-purple: #6a1b9a;
    --sidebar-bg: #ffffff;
    --content-bg: #f8f9fa;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --header-total-height: 96px; /* 40px top + 56px sub-header */
    --success-green: #28a745; /* ADD THIS LINE (a standard Bootstrap green) */
}

body {
    background-color: var(--content-bg);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding-top: var(--header-total-height);
    overflow-x: hidden;
}

/* --- 2. TWO-PART HEADER --- */
.page-header-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.top-header {
    background-color: #343a40;
    height: 40px;
    padding: 0 1rem;
    display: flex;
    align-items: center;
}

    .top-header .navbar-toggler {
        color: white;
        border: 1px solid rgba(255,255,255,0.5);
    }

.sub-header {
    background-color: #ffffff;
    height: 56px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
}

    .sub-header .navbar-brand {
        display: flex;
        align-items: center;
        gap: 8px;
        font-weight: 600;
        color: #333;
    }

        .sub-header .navbar-brand img {
            height: 32px;
        }

    .sub-header .user-info {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .sub-header .welcome-text {
        color: #6c757d;
        font-size: 0.9rem;
    }

    .sub-header .sign-out-link {
        text-decoration: none;
        font-weight: 500;
    }

/*.sidebar-main-toggle {
    background: transparent;
    border: none;
    color: var(--primary-blue);
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: 2rem;
    transition: transform 0.3s ease;
}*/

/* --- 3. SIDEBAR - POSITIONING & TRANSITION --- */
.sidebar {
    position: fixed;
    top: var(--header-total-height);
    bottom: 0;
    left: 0;
    z-index: 100;
    background-color: var(--sidebar-bg);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    width: var(--sidebar-width);
    transition: width 0.3s ease-in-out;
    padding-top: 1rem;
    overflow-y: auto;
}

/* --- 4. MAIN CONTENT - POSITIONING & TRANSITION --- */
main {
    margin-left: var(--sidebar-width);
    padding: 24px;
    transition: margin-left 0.3s ease-in-out;
}

/* --- 5. SIDEBAR - AESTHETIC STYLES (EXPANDED) --- */
.sidebar .nav-item {
    padding: 0 10px;
    margin-bottom: 8px;
}

    .sidebar .nav-item > .nav-link {
        display: flex;
        align-items: center;
        padding: 12px 15px;
        font-size: 0.95rem;
        font-weight: 500;
        border-radius: 8px;
        text-decoration: none;
        white-space: nowrap;
        overflow: hidden;
        color: white;
        background-color: var(--primary-blue);
    }

    /* MODIFY IT TO THIS */
    /*.sidebar .nav-item > .nav-link {
        display: flex;
        align-items: center;
        padding: 12px 15px;
        font-size: 0.95rem;
        font-weight: 500;
        border-radius: 8px;
        text-decoration: none;
        white-space: nowrap;
        overflow: hidden;
        color: #555;*/ /* CHANGE: Default text color to dark gray */
        /*background-color: transparent;*/ /* CHANGE: No background color */
        /*transition: color 0.2s ease, background-color 0.2s ease;*/ /* Update transition */
    /*}*/
/* ADD OR REPLACE WITH THIS */
.sidebar .nav-link:hover {
    background-color: #f0f0f0; /* Light gray background on hover */
    color: var(--primary-blue); /* Blue text on hover */
    transform: none; /* Remove any transform effects */
    box-shadow: none;
}
/* ADD OR REPLACE WITH THIS */
.sidebar .nav-link.active {
    color: var(--primary-blue);
    font-weight: 600; /* Make the active link bold */
    background-color: #e9ecef; /* A slightly darker gray for active */
}
/*.sidebar .sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
}

.sidebar-heading {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: #555;
    display: flex;
    align-items: center;
}

.sidebar-section-toggle {
    background-color: transparent;
    border: 1px solid #ccc;
    color: #555;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

    .sidebar-section-toggle i {
        font-size: 0.8rem;
        transition: transform 0.3s ease;
    }

    .sidebar-section-toggle:not(.collapsed) i {
        transform: rotate(-90deg);
    }*/

.sidebar .collapse .nav-link {
    background-color: transparent !important;
    color: #555;
}
/* FIND AND MODIFY THIS RULE */
.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background-color: transparent; /* ADD OR CHANGE THIS */
}
    /*.sidebar .collapse .nav-link.active {
        background-color: var(--active-purple) !important;
        color: white;
    }*/

/* ADD THIS NEW BLOCK IN ITS PLACE */

/* 
============================================================
  SECTION 9: SPECIFIC ACTIVE SUBMENU STYLES
============================================================
*/

/*
============================================================
  SECTION 9: SPECIFIC ACTIVE SUBMENU STYLES (CORRECTED)
============================================================
*/

/* Style for when "Standard APIs" link is active */
/* This looks for a link whose href STARTS WITH "/RestAPI" */
.sidebar .collapse .nav-link.active[href^="/RestAPI"] {
    background-color: var(--active-purple)!important; /* The blue from the headers */
    color: white !important;
    font-weight: 500;
}

/* Style for when "Web Service" link is active */
/* This looks for a link whose href STARTS WITH "/IPS" */
.sidebar .collapse .nav-link.active[href^="/IPS"] {
    background-color: var(--success-green) !important; /* The new green */
    color: white !important;
    font-weight: 500;
}
/* --- 6. THE COLLAPSED STATE LOGIC --- */
body.sidebar-is-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-is-collapsed main {
    margin-left: var(--sidebar-collapsed-width);
}

/*body.sidebar-is-collapsed .sidebar-main-toggle {
    transform: rotate(180deg);
}*/

body.sidebar-is-collapsed .nav-text,
body.sidebar-is-collapsed .sidebar-section-header {
    display: none;
}

body.sidebar-is-collapsed .nav-item > .nav-link {
    justify-content: center;
}

body.sidebar-is-collapsed .sidebar-section {
    display: none;
}

body.sidebar-is-collapsed .collapse {
    display: none !important;
}
/*
================================================================
  SECTION 7: TOP-RIGHT SIDEBAR TOGGLE BUTTON (FINAL VERSION)
================================================================
*/

/* This container holds the collapse button */
.sidebar-toggle-container {
    display: flex;
    justify-content: flex-end; /* THIS ALIGNS THE BUTTON TO THE RIGHT */
    padding: 0 10px 1rem 10px; /* Adds space around the button */
    border-bottom: 1px solid #e9ecef; /* Separator line */
    margin-bottom: 1rem; /* Space below the separator */
}

/* Style the button itself */
.sidebar-main-toggle-button {
    background-color: #f8f9fa;
    color: #555;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    line-height: 1; /* Ensures icon is centered vertically */
    transition: all 0.2s ease;
}

    .sidebar-main-toggle-button:hover {
        background-color: #e9ecef;
        color: #000;
    }

    /* This handles the icon rotation */
    .sidebar-main-toggle-button i {
        transition: transform 0.3s ease;
    }

body.sidebar-is-collapsed .sidebar-main-toggle-button i {
    transform: rotate(180deg); /* Flips '<<' to '>>' */
}



/*
============================================================
  SECTION 8: COLLAPSIBLE NAV-LINK ICON ROTATION
============================================================
*/

/* This pushes the icon to the far right */
.sidebar .nav-link[data-bs-toggle="collapse"] {
    justify-content: space-between;
}

/* Style for the rotating icon */
.sidebar .nav-link .toggle-icon {
    transition: transform 0.3s ease;
}

/* When the menu is OPEN, rotate the 'v' to a '^' */
.sidebar .nav-link:not(.collapsed) .toggle-icon {
    transform: rotate(180deg);
}