/* ==========================================================================
   1. Global & Body Styles
   ========================================================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f4f9;
    margin: 0;
    /* Default for mobile: stack content vertically */
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-x: hidden;
}

h2 {
    color: #333;
    margin-bottom: 25px;
}
/* ==========================================================================
   2. Main Layout
   ========================================================================== */

.sidebar {
    /* On mobile, sidebar is full width at the top */
    width: 100%;
    background-color: #343a40;
    color: white;
    padding: 20px;
    flex-shrink: 0;
}

.main-content {
    /* On mobile, main content is below the sidebar */
    flex-grow: 1;
    padding: 20px; /* Reduce padding for mobile */
    overflow-y: auto;
}

/* For pages with a centered content box */
.container {
    max-width: 1200px;
    margin: auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   3. Sidebar Navigation
   ========================================================================== */

.sidebar-header {
    text-align: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #495057;
}

.sidebar-header h2 {
    color: white;
    text-align: left;
    font-size: 1.5em;
    margin: 0;
}

.nav-section h3 {
    color: #adb5bd;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 20px;
    margin-bottom: 10px;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-list li a {
    display: block;
    color: #dee2e6;
    text-decoration: none;
    padding: 12px 15px;
    border-radius: 5px;
    transition: background-color 0.2s, color 0.2s;
}

.nav-list li a:hover {
    background-color: #495057;
    color: #fff;
}

.nav-list li a.disabled {
    color: #6c757d;
    cursor: not-allowed;
}

/* Sign out link at the bottom */
.sidebar .nav-section[style*="margin-top: auto;"] {
    margin-top: auto;
}

/* ==========================================================================
   4. Forms & Inputs
   ========================================================================== */

form {
    margin-top: 20px;
}

fieldset {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    background-color: #fff;
}

legend {
    font-weight: bold;
    font-size: 1.2em;
    padding: 0 10px;
    color: #495057;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #343a40;
}

label.required::after {
    content: ' *';
    color: #dc3545;
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
}

textarea {
    resize: vertical;
}

.form-group { flex: 1; margin-bottom: 15px; }

.grid-container {
    display: grid;
    gap: 15px 25px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.full-width {
    grid-column: 1 / -1;
}

.form-row { 
    display: flex; 
    gap: 20px; 
    flex-wrap: wrap; 
}

.dynamic-list { border:1px solid #ddd; padding:15px; border-radius:4px; margin-bottom:10px; }
.party-block { margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #eee; }
.party-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0;}
.party-block .input-group:first-child input { margin-bottom: 10px; }
.input-group { 
    display: flex; 
    gap: 10px; 
    align-items: center; 
    margin-bottom: 10px; 
    flex-wrap: wrap; 
}
.party-role { flex: 3; }
.party-rep { flex: 2; text-align: left; }
.lawyer-select { flex: 2; } 
.lawyer-role { flex: 2; }
.btn { padding: 5px 10px; border: none; border-radius: 4px; cursor: pointer; color: #fff; height: 38px; }
.btn-add { background-color: #28a745; }
.btn-remove { background-color: #dc3545; flex-shrink: 0; }

/* ==========================================================================
   5. Buttons & Links
   ========================================================================== */

/* General purpose form submission button */
button[type="submit"],
input[type="submit"] {
    background-color: #007bff;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    width: 100%;
}

button[type="submit"]:hover,
input[type="submit"]:hover {
    background-color: #0056b3;
}

/* Green button for links like "Add New" */
.button-link {
    display: inline-flex; 
    align-items: center;  
    justify-content: center; 
    background-color: #28a745;
    color: white !important;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 16px;
    white-space: nowrap;
    box-sizing: border-box;
    height: 42px; 
}

.button-add {
    background-color: #28a745; 
    color: white;              
    border: 1px solid #28a745; 
    padding: 8px 20px;
    border-radius: 4px;
    text-decoration: none;
    text-align: center;
    font-weight: 700;
    min-width: 140px; 
}


/* Small action links for tables (Edit, Delete) */
.action-link {
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    color: white !important;
    margin-right: 5px;
    white-space: nowrap;
}

.action-link.edit {
    background-color: #ffc107;
}

.action-link.delete {
    background-color: #dc3545;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 25px;
    color: #6c757d;
    text-decoration: none;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap; 
}

.header-actions h2 {
    text-align: left; 
}

/* ==========================================================================
   6. Tables
   ========================================================================== */

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

th,
td {
    padding: 12px 15px;
    border: 1px solid #ddd;
    text-align: left;
}

th {
    background-color: #007bff;
    color: white;
    font-weight: bold;
}

/* ==========================================================================
   7. Specific Components (Filter Bar, Collapsibles, etc.)
   ========================================================================== */

/* Filter Bar for lists like Matters */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  margin-bottom: 25px;
  gap: 20px;
  flex-wrap: wrap; 
}

.filter-bar__left {
  flex-grow: 1;
}

.filter-bar__form {
  display: flex;
  align-items: center;
  gap: 10px;
}
.filter-bar label {
    font-weight: bold;
    white-space: nowrap;
    margin-bottom: 0;
    flex-shrink: 0; 
}

.filter-bar__form select {
  flex: 1;
  height: 42px;
  min-width: 250px;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #ced4da;
  box-sizing: border-box;
}

.filter-bar__right {
  flex-shrink: 0;
}

.selection-form {
    display: flex;
    gap: 15px;
    align-items: center;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    flex-wrap: wrap; 
}

.filter-bar select {
    flex-grow: 1; 
    height: 42px;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ced4da;
    box-sizing: border-box;
}

.filter-bar .button-link {
    flex-shrink: 0; 
}

/* Collapsible Sections */
.collapsible-header {
    cursor: pointer;
    position: relative;
    user-select: none;
    padding: 10px 0;
}

.collapsible-header::after {
    content: '\25B6'; 
    font-size: 0.8em;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s ease-in-out;
}

.collapsible-header.active::after {
    transform: translateY(-50%) rotate(90deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

/* Collapsible sections INSIDE the dark sidebar */
.sidebar .collapsible-header {
    background-color: transparent;
    color: #adb5bd;
    border: none;
    padding: 12px 25px 12px 0;
}

.sidebar .collapsible-header::after {
    color: #adb5bd;
    right: 5px;
}

.sidebar .collapsible-content {
    background-color: transparent;
    border: none;
    padding-left: 15px;
}

/* Collapsible sections INSIDE the main content area */
.main-content .collapsible-header {
    background-color: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-weight: 400;
    color: #495057;
    padding: 10px 15px;
    margin-top: 15px;
}

.main-content .collapsible-header:hover {
    border-color: #80bdff;
}

.main-content .collapsible-content {
    padding: 15px;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 5px 5px;
}

.info-box {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    color: #495057;
    border-radius: 4px;
}

.selection-form label {
            font-weight: bold;
            white-space: nowrap;
        } 
/* ==========================================================================
   8. Plugin Overrides (Select2)
   ========================================================================== */

.select2-container {
    width: 100% !important;
    box-sizing: border-box;
}

.select2-container .select2-selection--single {
    height: 42px !important;
    border: 1px solid #ced4da !important;
    padding: 5px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 8px !important;
}

.select2-container .select2-selection--multiple {
    min-height: 42px !important;
    border: 1px solid #ced4da !important;
    padding-top: 5px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #007bff;
    border-color: #0056b3;
    color: white;
    padding: 2px 8px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: rgba(255, 255, 255, 0.7);
    margin-right: 5px;
}

/* Place this in your CSS file or in a <style> block */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 6px; 
    transform: translateY(5px); 
}

.checkbox-group input[type="checkbox"] {
    margin: 0;
    vertical-align: middle;
    transform: translateY(-2px);
}
/* ==========================================================================
   9. Media Query for Desktop
   ========================================================================== */

/* Apply this for screens 768px and wider (tablets & desktops) */
@media (min-width: 768px) {
    body {
        /* Change direction to row for side-by-side layout */
        flex-direction: row;
        overflow-y: hidden; /* Prevent vertical scrolling */
    }

    .sidebar {
        /* Restore fixed width for desktop */
        width: 260px;
    }

    .main-content {
        padding: 40px; /* Restore desktop padding */
        overflow-y: auto; /* Allow vertical scrolling for main content */
    }
}
/* ==========================================================================
   10. Dashboard Styles (New Section)
   ========================================================================== */

.stats-container {
    display: flex;
    justify-content: space-around;
    gap: 30px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.stat-card {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    text-align: center;
    flex-grow: 1;
    min-width: 200px;
}

.stat-card .number {
    font-size: 3em;
    font-weight: bold;
    color: #007bff;
}

.stat-card .label {
    font-size: 1em;
    color: #555;
    margin-top: 5px;
}

.activity-card {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.activity-card h2 {
    color: #007bff;
    margin-top: 0;
}

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-list li {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.activity-list li:last-child {
    border-bottom: none;
}

.activity-item-title {
    font-weight: bold;
    color: #333;
}

.activity-item-subtitle {
    font-size: 0.9em;
    color: #777;
}

/* Add this to the end of your styles.css file */