/* Reset and Base Styles */
html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Define Color Palette and Variables */
:root {
    --bg-primary: #f8f9fa;      /* Very light gray for main content background */
    --bg-secondary: #ffffff;    /* White for sidebar, cards */
    --text-primary: #212529;    /* Dark gray for main text */
    --text-secondary: #6c757d;  /* Medium gray for secondary text */
    --border-color: #dee2e6;    /* Light gray for borders */
    --accent-primary: #0d6efd;  /* Standard Bootstrap blue - can refine */
    --accent-primary-hover: #0b5ed7; /* Darker blue for hover */
    --sidebar-width: 250px;     /* Width of the sidebar */
    --shadow-sm: 0 .125rem .25rem rgba(0, 0, 0, .075);
    --shadow-md: 0 .5rem 1rem rgba(0, 0, 0, .15);
}

body {
  margin: 0; /* Remove default margin */
  padding-left: var(--sidebar-width); /* Make space for the fixed sidebar */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    overflow-y: auto; /* Allow scrolling if content overflows */
}

.sidebar-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.sidebar-header img {
    max-height: 40px; /* Adjust logo size */
    margin-bottom: 0.5rem;
}

.sidebar-header .app-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar .nav-pills {
    flex-direction: column;
}

.sidebar .nav-link {
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: 0.375rem; /* Bootstrap's default */
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Space between icon and text */
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.sidebar .nav-link i { /* Style for icons */
    width: 1.25em; /* Ensure icons align nicely */
    text-align: center;
}


.sidebar .nav-link:hover {
    background-color: rgba(0, 0, 0, 0.05); /* Subtle hover */
    color: var(--text-primary);
}

.sidebar .nav-link.active {
    background-color: var(--accent-primary);
    color: var(--bg-secondary);
}

.sidebar .nav-link.active:hover {
    background-color: var(--accent-primary-hover);
}

/* Main Content Area Styles */
.main-content {
    flex-grow: 1; /* Takes remaining vertical space */
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.main-content header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.main-content header h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

main {
    flex-grow: 1; /* Ensures main content pushes footer down */
}

/* Footer Styles */
.footer {
    background-color: var(--bg-primary); /* Match main background */
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    text-align: center;
    font-size: 0.875rem;
    margin-top: auto; /* Pushes footer to bottom */
    /* Removed absolute positioning */
    width: calc(100% - var(--sidebar-width)); /* Adjust width */
    margin-left: var(--sidebar-width); /* Align with main content */
}

.footer a {
    color: var(--accent-primary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}


/* Component Refinements */

/* Cards */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem; /* Add spacing between cards */
}

.card-header {
    background-color: rgba(0, 0, 0, 0.03); /* Very subtle header background */
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.card .card-header h1,
.card .card-header h2,
.card .card-header h3,
.card .card-header h4,
.card .card-header h5,
.card .card-header h6 {
    margin-bottom: 0;
    font-size: 1.1rem; /* Slightly smaller header in cards */
}

/* Buttons */
.btn-primary {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-primary:hover {
    background-color: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  /* Keep accessibility focus ring, adjust color if needed */
  box-shadow: 0 0 0 0.1rem var(--bg-secondary), 0 0 0 0.25rem var(--accent-primary);
}

/* Tables */
table td:first-child {
    white-space: nowrap;
    width: 1%;
}

table td:first-child .btn {
    margin-right: 0.25rem;
}
table td:first-child .btn:last-child {
    margin-right: 0;
}

/* Forms */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border-color: var(--border-color);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--accent-primary), 0.25); /* Use accent color for focus */
}

/* Dashboard Card Accents & Utilities (Moved from Index.cshtml) */
.border-left-primary { border-left: 0.25rem solid var(--accent-primary) !important; }
.border-left-success { border-left: 0.25rem solid #198754 !important; } /* Bootstrap success green */
.border-left-info { border-left: 0.25rem solid #0dcaf0 !important; }    /* Bootstrap info cyan */
.border-left-warning { border-left: 0.25rem solid #ffc107 !important; } /* Bootstrap warning yellow */

.text-xs { font-size: .7rem; }
.text-gray-300 { color: #dddfeb !important; } /* Lighter gray for icons */
.text-gray-800 { color: #5a5c69 !important; } /* Darker gray for text */


/* Responsive adjustments if needed */
@media (max-width: 768px) {
    body {
        padding-left: 0; /* Remove padding for sidebar */
    }

    .sidebar {
        /* Example: Hide sidebar by default on smaller screens */
        /* transform: translateX(-100%); */
        /* transition: transform 0.3s ease-in-out; */
        /* Add a button to toggle sidebar visibility */
        /* For simplicity now, we'll keep it visible but adjust main content */
        position: relative; /* Change from fixed */
        width: 100%;
        height: auto; /* Adjust height */
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        box-shadow: none;
        margin-bottom: 1rem;
    }

    .main-content {
        padding: 1rem; /* Reduce padding */
    }

    .footer {
        width: 100%;
        margin-left: 0;
    }
}
