:root {
  --primary-color: #2c3e50; /* Dark Blue-Gray */
  --secondary-color: #34495e; /* Lighter Blue-Gray */
  --accent-color: #3498db; /* Bright Blue */
  --success-color: #27ae60; /* Green */
  --warning-color: #f39c12; /* Yellow-Orange */
  --error-color: #e74c3c; /* Red */
  --light-gray: #ecf0f1; /* Very Light Gray */
  --medium-gray: #bdc3c7; /* Medium Gray */
  --dark-gray: #7f8c8d; /* Dark Gray */
  --background-color: #f4f6f9; /* Light Background */
  --text-color: #333;
  --card-background: #ffffff;
  --border-radius: 8px;
  --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --input-border: #ccc;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
} 

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  font-size: 16px;
}

.container {
  max-width: 1400px; /* Wider container */
  margin: 20px auto;
  padding: 20px;
}

header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 25px 0;
  text-align: center;
  border-radius: var(--border-radius);
  margin-bottom: 30px;
  box-shadow: var(--box-shadow);
}

header h1 {
  margin-bottom: 5px;
  font-size: 2.2em;
  font-weight: 600;
}
header p {
  font-size: 1.1em;
  opacity: 0.9;
}

/* Tabs */
.tab-container {
  margin-bottom: 30px;
  display: flex;
  justify-content: center;
  background-color: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
}

.tab-button {
  padding: 15px 30px; /* Default padding for tabs with text */
  background-color: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1em; /* Larger font */
  font-weight: 600; /* Bolder */
  color: var(--primary-color);
  transition: all 0.3s ease;
  border-bottom: 4px solid transparent; /* Thicker indicator */
  flex-grow: 1; /* Make buttons fill space */
  text-align: center;
  display: inline-flex; /* Added for alignment */
  align-items: center; /* Added for alignment */
  justify-content: center; /* Added for alignment */
  vertical-align: middle; /* Added for alignment */
}
.tab-button:disabled {
  color: var(--medium-gray);
  cursor: not-allowed;
  opacity: 0.6;
}

.tab-button:not(:disabled):hover {
  background-color: rgba(52, 152, 219, 0.1); /* Light blue hover */
  color: var(--accent-color);
}

.tab-button.active {
  border-bottom-color: var(--accent-color);
  color: var(--accent-color);
  background-color: rgba(52, 152, 219, 0.05); /* Subtle active background */
}

.tab-button i {
  margin-right: 8px; /* Default space for icons next to text */
}

/* Add some margin between tab buttons */
.tab-container .tab-button {
    margin-right: 2px; /* Adjust as needed */
}
.tab-container .tab-button:last-child {
    margin-right: 0;
}

/* Style for the new Global Search button to match others */
/* REMOVE THIS BLOCK - it duplicates and overrides incorrectly */
/*
#global-search-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
    margin-right: 5px;
}

#global-search-btn:hover {
    background-color: #5a6268;
}
*/

/* ADD/MODIFY THIS: Specific style for the icon-only search button */
#global-search-btn {
    /* padding: 15px 16px; Adjust horizontal padding to be closer to vertical for square shape */
    flex-grow: 0; /* Don't allow the icon-only button to grow like text buttons */
}

#global-search-btn i {
    margin-right: 0; /* No space needed when only icon is present */
}

/* Global Search Modal Specific Styles */
#globalSearchModal .modal-body {
    max-height: 400px; /* Limit height */
    overflow-y: auto; /* Add scroll if content exceeds height */
}

#global-search-results ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#global-search-results li {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#global-search-results li span {
    flex-grow: 1;
    margin-right: 10px;
    word-break: break-all; /* Prevent long filenames from breaking layout */
}

#global-search-results .load-file-from-search-btn {
    /* Use existing btn-tiny styles if suitable, or add specific ones */
    flex-shrink: 0; /* Prevent button from shrinking */
}

/* Adjust loading indicator size if needed */
.loading-spinner.small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}
.loading p {
    margin-left: 8px; /* Space between spinner and text */
}

/* Ensure modal content sizing is flexible */
/* .modal-content.medium {
     max-width: 600px;  /* Commented out as per suggestion 
} */

/* Card */
.card {
  background-color: var(--card-background);
  border-radius: var(--border-radius);
  padding: 30px; /* More padding */
  margin-bottom: 30px;
  box-shadow: var(--box-shadow);
}

/* Forms */
.fetch-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); /* Responsive grid */
  gap: 30px;
  margin-bottom: 20px;
}

.data-form {
  border: 1px solid var(--light-gray);
  padding: 20px;
  border-radius: var(--border-radius);
  background-color: #fdfdfd;
}

.data-form h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--primary-color);
  border-bottom: 1px solid var(--light-gray);
  padding-bottom: 10px;
  font-size: 1.3em;
}
.data-form h3 i {
  margin-right: 8px;
  color: var(--accent-color);
}


.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--secondary-color);
  font-size: 0.95em;
}

input[type="text"],
input[type="number"],
input[type="url"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 12px 15px; /* More padding */
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font-size: 1em;
  transition: border-color 0.3s, box-shadow 0.3s;
  background-color: #fff;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

input[type="file"] {
  padding: 8px; /* Adjust padding for file input */
  cursor: pointer;
}
input::file-selector-button {
  font-weight: bold;
  color: var(--accent-color);
  padding: 0.5em 1em;
  border: 1px solid var(--accent-color);
  border-radius: 3px;
  background-color: white;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-right: 10px;
}
input::file-selector-button:hover {
  background-color: rgba(52, 152, 219, 0.1);
}


/* Buttons */
.btn {
  display: inline-block;
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  text-align: center;
  transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
  text-decoration: none; /* For link buttons */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.btn:hover:not(:disabled) {
  background-color: #2980b9; /* Darker blue */
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.btn:disabled {
  background-color: var(--medium-gray);
  cursor: not-allowed;
  opacity: 0.7;
}

.btn i {
  margin-right: 6px;
}

.btn-primary { background-color: var(--accent-color); }
.btn-primary:hover:not(:disabled) { background-color: #2980b9; }
.btn-secondary { background-color: var(--dark-gray); }
.btn-secondary:hover:not(:disabled) { background-color: #6c7a7c; }
.btn-success { background-color: var(--success-color); }
.btn-success:hover:not(:disabled) { background-color: #219a52; }
.btn-warning { background-color: var(--warning-color); color: #fff; }
.btn-warning:hover:not(:disabled) { background-color: #da8c10; }
.btn-danger { background-color: var(--error-color); }
.btn-danger:hover:not(:disabled) { background-color: #c0392b; }
.btn-info { background-color: #1abc9c; } /* Teal */
.btn-info:hover:not(:disabled) { background-color: #16a085; }


.btn-group { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.btn-small { padding: 8px 16px; font-size: 0.9em; }
.btn-tiny { padding: 4px 8px; font-size: 0.8em; font-weight: normal; box-shadow: none;}
.btn-tiny i { margin-right: 3px;}

/* Alerts / Status Messages */
#status-messages { margin-bottom: 20px; }
.alert {
  padding: 15px 20px;
  margin-bottom: 15px;
  border-radius: var(--border-radius);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid transparent;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.alert i.fa-times { cursor: pointer; margin-left: 15px; }
.alert-success { background-color: rgba(39, 174, 96, 0.1); color: var(--success-color); border-color: rgba(39, 174, 96, 0.3); }
.alert-error { background-color: rgba(231, 76, 60, 0.1); color: var(--error-color); border-color: rgba(231, 76, 60, 0.3); }
.alert-warning { background-color: rgba(243, 156, 18, 0.1); color: var(--warning-color); border-color: rgba(243, 156, 18, 0.3); }

/* Tab Content */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Loading Indicator */
.loading {
  display: none; /* Hidden by default */
  text-align: center;
  padding: 20px;
  color: var(--dark-gray);
}
.loading-spinner {
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-left-color: var(--accent-color);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}
.loading p { font-size: 0.9em; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* File Management Tab */
.file-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.file-action-box {
  border: 1px solid var(--light-gray);
  padding: 20px;
  border-radius: var(--border-radius);
}
.file-action-box h4 { margin-top: 0; margin-bottom: 15px; color: var(--primary-color); }

#file-list-container {
  margin-top: 20px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--light-gray);
  padding: 15px;
  border-radius: var(--border-radius);
  background-color: #f9fafb;
}
#file-list { list-style: none; padding: 0; margin: 0; }
#file-list li {
  padding: 10px 15px;
  border-bottom: 1px solid var(--light-gray);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
}
#file-list li:last-child { border-bottom: none; }
#file-list li:hover { background-color: var(--light-gray); }
#file-list li .file-actions-buttons button { margin-left: 5px; }
#refresh-file-list-btn { margin-top: 15px; }

/* Preset File List Styles (similar to user file list) */
#preset-file-list-container {
  margin-top: 20px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--light-gray);
  padding: 15px;
  border-radius: var(--border-radius);
  background-color: #f9fafb;
}
#preset-file-list { list-style: none; padding: 0; margin: 0; }
#preset-file-list li {
  padding: 10px 15px;
  border-bottom: 1px solid var(--light-gray);
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* cursor: pointer; */ /* Remove default cursor, rely on buttons */
  transition: background-color 0.2s;
}
#preset-file-list li:last-child { border-bottom: none; }
#preset-file-list li:hover { background-color: var(--light-gray); }
#preset-file-list li .file-actions-buttons button { margin-left: 5px; }

/* Inline Password Prompt for Delete */
.file-actions-buttons {
    position: relative; /* Needed for absolute positioning of the prompt */
}

.password-prompt-container {
    position: absolute;
    right: 0; /* Align to the right of the buttons container */
    top: 100%; /* Position below the buttons */
    margin-top: 5px; /* Small space below */
    background-color: #fff;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    padding: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10; /* Ensure it's above other elements */
    display: flex; /* Align items horizontally */
    align-items: center;
    gap: 5px; /* Space between elements */
    /* Add animation/transition */
    opacity: 0;
    transform: translateY(-5px); /* Start slightly up */
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    pointer-events: none; /* Initially ignore clicks */
}

/* Style for action buttons within table cells */
#file-list-table td.file-actions-buttons,
#preset-file-list-table td.file-actions-buttons {
    text-align: center; /* Center the dropdown button */
    white-space: nowrap; /* Prevent wrapping */
    position: relative; /* Keep for inline prompt positioning AND dropdown */
    padding-top: 5px; /* Adjust vertical alignment */
    padding-bottom: 5px;
}

/* Actions Dropdown Styles */
.actions-dropdown {
    position: relative; /* Container for absolute positioning */
    display: inline-block; /* Take only needed width */
}

.actions-dropdown-btn {
    /* Inherits btn, btn-secondary, btn-tiny */
    /* Add any specific overrides */
    padding: 4px 10px; /* Adjust padding */
}

.actions-dropdown-content {
    display: none; /* Hidden by default */
    position: absolute;
    background-color: #f9f9f9;
    min-width: 140px; /* Adjust width as needed */
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 10; /* Ensure it's above table rows */
    border-radius: 4px;
    padding: 5px 0;
    right: 0; /* Align dropdown to the right of the button */
    margin-top: 2px; /* Small space below button */
    text-align: left; /* Align text left within dropdown */
}

.actions-dropdown-content a {
    color: black;
    padding: 8px 12px; /* Adjust padding */
    text-decoration: none;
    display: block;
    font-size: 0.9em;
    white-space: nowrap; /* Prevent link text wrapping */
    transition: background-color 0.2s;
}
.actions-dropdown-content a i {
    margin-right: 8px; /* Space between icon and text */
    width: 1.1em; /* Align icons */
    text-align: center;
    font-size: 1.1em; /* Increase icon size slightly */
    margin-right: 6px; /* Adjust spacing if needed */
    vertical-align: middle; /* Align icon better with text */
}

.actions-dropdown-content a:hover {
    background-color: #ddd;
}

/* Show dropdown when .show-dropdown class is added by JS */
.actions-dropdown-content.show-dropdown {
    display: block;
}

/* Adjust inline prompt positioning relative to the TD */
.inline-prompt-container {
    position: absolute;
    /* Keep right: 0; top: 100%; etc. from previous styles */
    /* Ensure it appears correctly even with the dropdown */
    right: 0;
    top: 100%;
    margin-top: 5px;
    background-color: #fff;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    padding: 10px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    z-index: 11; /* Higher than dropdown content */
    display: none; /* Hidden by default, shown by JS adding 'prompt-active' to TD */
    /* flex properties remain the same */
    min-width: 250px;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Make prompt visible ONLY when parent TD has 'prompt-active' class */
td.file-actions-buttons.prompt-active .inline-prompt-container {
    display: flex; /* Show as flex container */
    /* Animation properties remain the same */
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Ensure the first button doesn't have left margin if needed */
/* .file-actions-buttons > .password-prompt-container { ... } */ /* This might be redundant now */

/* Inline Prompts (Generic and Specific) - Adjust positioning relative to cell */
/* .inline-prompt-container { ... } */ /* Styles mostly remain the same */

/* NEW: Inline Error Message Styling */
.inline-error-message {
    color: var(--error-color);
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 5px; /* Space from input */
    margin-right: 5px; /* Space before buttons */
    white-space: nowrap; /* Prevent wrapping */
    display: block; /* Make it a block to appear below input if needed */
    width: 100%; /* Take full width within its flex context if needed */
    text-align: left; /* Align text left */
    padding: 2px 0; /* Small vertical padding */
    order: 1; /* Position after input fields if using flex order */
    width: 100%; /* Take full width when wrapped */
    order: 1; /* Ensure error comes after inputs */
    margin-left: 0; /* Reset margin */
    margin-right: 0;
    text-align: center; /* Center error text */
}

/* Adjust prompt container flex-wrap if error needs its own line */
.inline-prompt-container {
    flex-wrap: wrap; /* Allow wrapping */
}
.inline-prompt-container input {
    width: calc(100% - 16px); /* Adjust width considering padding */
    margin-bottom: 5px; /* Add space below input if error wraps */
    order: 0; /* Ensure inputs come first */
}
.inline-error-message {
    width: 100%; /* Take full width when wrapped */
    order: 1; /* Ensure error comes after inputs */
    margin-left: 0; /* Reset margin */
    margin-right: 0;
    text-align: center; /* Center error text */
}
.inline-prompt-container button {
    order: 2; /* Ensure buttons come last */
    margin-top: 5px; /* Add space above buttons if wrapped */
}
/* Adjust button alignment if needed when wrapped */
.inline-prompt-container > div:last-child { /* Assuming buttons are wrapped in a div */
    width: 100%;
    text-align: right;
}

/* Section Divider */
.section-divider {
    border: 0;
    border-top: 1px solid #eee;
    margin: 30px 0;
}

/* Dashboard Styles */
#dashboard-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background-color: var(--light-gray);
  border-radius: var(--border-radius);
  flex-wrap: wrap;
  gap: 10px;
}
#current-data-info { font-weight: 600; color: var(--primary-color); }
.dashboard-buttons { display: flex; gap: 10px; flex-wrap: wrap; }

#dashboard-content h2 {
  font-size: 1.6em;
  color: var(--primary-color);
  margin-top: 40px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 8px;
  display: flex;
  align-items: center;
}
#dashboard-content h2 i {
  margin-right: 12px;
  color: var(--accent-color);
}


.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Responsive grid */
  gap: 20px;
  margin-bottom: 30px;
}

/* Add cursor pointer specifically for clickable summary cards on the dashboard */
#summary-cards .summary-card-item[data-modal-target] {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#summary-cards .summary-card-item[data-modal-target]:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* Remove hover effect from non-clickable cards */
#summary-cards .summary-card-item:not([data-modal-target]) {
    cursor: default;
}
#summary-cards .summary-card-item:not([data-modal-target]):hover {
    transform: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08); /* Keep original shadow */
}

/* Style for the small view button in summary cards */
.summary-card-view-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 5px !important; /* Override btn-tiny */
    font-size: 0.7em !important; /* Override btn-tiny */
    line-height: 1;
    border-radius: 3px;
}
.summary-card-view-btn i {
    margin-right: 0; /* No margin for icon only */
}

/* Placeholder style for loading cards */
.summary-card-item.placeholder {
    color: #aaa;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px; /* Ensure placeholder has some height */
}

/* Generic Modal Summary Cards */
.modal-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Adjusted min width slightly */
    gap: 15px; /* Increased gap slightly */
    margin-bottom: 20px; /* Space below the cards */
}

.summary-card-item {
    background-color: #fff;
    padding: 15px; /* Standardized padding */
    border-radius: 8px; /* Standardized radius */
    border: 1px solid #e0e0e0; /* Slightly softer border */
    box-shadow: 0 2px 5px rgba(0,0,0,0.08); /* Standardized shadow */
    display: flex; /* Use flex for internal alignment */
    flex-direction: column; /* Stack title and value vertically */
    position: relative; /* Needed for absolute positioning of copy button */
    text-align: center; /* Center text in cards */
}

.summary-card-item h4 {
    margin: 0 0 8px 0; /* Space below title */
    font-size: 0.9em; /* Standardized title size */
    color: var(--secondary-color); /* Use secondary color for title */
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center; /* Center title content */
    gap: 6px; /* Space between icon and text */
    text-transform: uppercase; /* Uppercase titles */
}
.summary-card-item h4 i {
    color: var(--primary-color); /* Icon color */
    font-size: 1em; /* Standardized icon size */
}

.summary-card-item .value {
    font-size: 1.6em; /* Standardized value size */
    font-weight: bold;
    color: var(--text-color);
    word-break: break-word; /* Prevent long names/enrollments from overflowing */
    /* margin-top: auto; Push value towards bottom if needed */
}
.summary-card-item .value .unit {
    font-size: 0.6em; /* Standardized unit size */
    font-weight: normal;
    margin-left: 3px; /* Standardized margin */
    color: var(--secondary-color);
}

.chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); /* Responsive grid */
  gap: 30px;
  margin-bottom: 30px;
}

.chart-container {
  background-color: var(--card-background);
  padding: 25px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}
.chart-box {
  min-height: 400px; /* Ensure charts have space */
  display: flex;
  flex-direction: column;
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.chart-header h3 {
  margin: 0;
  font-size: 1.2em;
  color: var(--primary-color);
}
.chart-type-select {
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--input-border);
  font-size: 0.9em;
}

canvas {
  width: 100% !important;
  height: auto !important;
  max-height: 450px; /* Limit chart height */
  flex-grow: 1; /* Allow canvas to fill space in chart-box */
}

/* Tables (DataTables customization) */
.dataTables_wrapper {
  padding-top: 10px;
}
table.dataTable {
  width: 100% !important; /* Override DataTables width */
  border-collapse: collapse !important;
  margin-bottom: 20px;
}
table.dataTable thead th {
  background-color: var(--primary-color);
  color: white;
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--secondary-color);
}
table.dataTable tbody td {
  padding: 10px 15px;
  border-bottom: 1px solid var(--light-gray);
  vertical-align: middle;
}

/* Style for Name cell to align text and button */
table.dataTable tbody td.file-name-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px; /* Space between name and button */
}

.file-name-text {
    flex-grow: 1; /* Allow name to take available space */
    overflow: hidden; /* Prevent long names breaking layout */
    text-overflow: ellipsis; /* Add ellipsis for overflow */
    white-space: nowrap; /* Keep name on one line */
}

.open-file-btn-name,
.open-preset-btn-name { /* Added preset button class */
    /* Inherits btn, btn-success, btn-tiny */
    flex-shrink: 0; /* Prevent button from shrinking */
    /* Add specific overrides if needed */
    padding: 4px 8px;
}
.open-file-btn-name i,
.open-preset-btn-name i { /* Added preset button class */
    margin-right: 4px; /* Adjust icon spacing */
    font-size: 1.1em; /* Increase icon size slightly */
    margin-right: 6px; /* Adjust spacing if needed */
    vertical-align: middle; /* Align icon better with text */
}

table.dataTable tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}
table.dataTable tbody tr:hover {
  background-color: rgba(52, 152, 219, 0.1); /* Light blue hover */
}
.dataTables_filter input {
  margin-left: 0.5em;
  padding: 6px 10px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
}
.dataTables_length select {
  margin-left: 0.5em;
  margin-right: 0.5em;
  padding: 6px 10px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
}
.dataTables_paginate .paginate_button {
  padding: 0.4em 0.8em;
  margin-left: 2px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--primary-color) !important; /* Override DT styles */
  background: white;
}
.dataTables_paginate .paginate_button.current,
.dataTables_paginate .paginate_button:hover {
  background: var(--accent-color);
  color: white !important;
  border-color: var(--accent-color);
}
.dataTables_paginate .paginate_button.disabled {
  color: var(--medium-gray) !important;
  background: var(--light-gray);
  cursor: default;
}
.dt-buttons .btn { /* Style DataTables export buttons */
  padding: 8px 16px;
  font-size: 0.9em;
  margin-left: 5px;
  box-shadow: none;
}
.dt-buttons .btn:hover {
  transform: none;
  box-shadow: none;
}

/* Subject Grade Table Specific Styles */
.subject-grade-table th { background-color: var(--accent-color); }
.grade-Aplus { background-color: rgba(46, 204, 113, 0.1); }
.grade-A { background-color: rgba(39, 174, 96, 0.1); }
.grade-Bplus { background-color: rgba(52, 152, 219, 0.1); }
.grade-B { background-color: rgba(41, 128, 185, 0.1); }
.grade-Cplus { background-color: rgba(241, 196, 15, 0.1); }
.grade-C { background-color: rgba(243, 156, 18, 0.1); }
.grade-Dplus { background-color: rgba(230, 126, 34, 0.1); }
.grade-D { background-color: rgba(211, 84, 0, 0.1); }
.grade-F { background-color: rgba(231, 76, 60, 0.1); }

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden; /* Prevent body scroll when modal is open */
  background-color: rgba(0,0,0,0.6); /* Darker overlay */
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: #fefefe;
  margin: 3% auto; /* Smaller top margin */
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: 0 5px 25px rgba(0,0,0,0.2);
  width: 80%;
  max-width: 900px; /* Default max width */
  max-height: 90vh; /* Limit height */
  overflow-y: auto; /* Enable scroll within modal */
  position: relative;
  animation: slideIn 0.4s ease-out;
}
.modal-content.large { max-width: 1200px; }
.modal-content.x-large { max-width: 1400px; }


@keyframes slideIn {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Container for modal control buttons */
.modal-controls-container {
    position: absolute;
    top: 10px; /* Adjust as needed */
    right: 15px; /* Adjust as needed */
    display: flex; /* Use flexbox for alignment */
    gap: 10px; /* Space between buttons */
    z-index: 1051; /* Ensure above modal content */
}

/* Common styles for modal control buttons (Close, Fullscreen) */
.modal-control-btn {
    /* Use browser default button styles where possible */
    cursor: pointer;
    border: 1px solid #ccc; /* Simple border */
    background-color: #f0f0f0; /* Light background */
    padding: 2px 8px; /* Adjust padding */
    line-height: 1.2; /* Adjust line height */
    border-radius: 3px; /* Slight rounding */
    font-size: 1em; /* Adjust font size */
    font-weight: bold;
    color: #555; /* Darker text */
    transition: background-color 0.2s, border-color 0.2s;
    padding: 6px; /* Slightly more padding */
    min-width: 28px; /* Slightly larger minimum size */
    min-height: 28px;
    /* If using FontAwesome/Material, uncomment and adjust font-size: */
    /* font-size: 1.4em; */
}
.modal-control-btn:hover,
.modal-control-btn:focus {
    background-color: #e0e0e0; /* Darker on hover */
    border-color: #bbb;
    color: #333;
    text-decoration: none;
    outline: none;
}

/* Specific styles (mostly icon size adjustments if needed) */
.modal .close {
    /* Use '×' symbol */
    font-size: 1.2em; /* Adjust size for the symbol */
    padding: 0px 8px; /* Fine-tune padding */
}

.modal-fullscreen-btn {
    /* Use symbols like ⛶ / ↘↙ */
    font-size: 1em; /* Adjust size */
}

/* Fullscreen Modal State */
.modal.fullscreen {
    padding: 0;
    overflow: hidden;
}
.modal.fullscreen .modal-content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    padding: 50px 20px 20px; /* Increase top padding for buttons */
    border-radius: 0;
    box-shadow: none;
}

/* Adjust position of the CONTROLS CONTAINER in fullscreen mode */
.modal.fullscreen .modal-controls-container {
    position: fixed; /* Use fixed positioning in fullscreen */
    top: 10px; /* Keep consistent top position */
    right: 15px; /* Keep consistent right position */
}

:root {
  --primary-color: #2c3e50; /* Dark Blue-Gray */
  --secondary-color: #34495e; /* Lighter Blue-Gray */
  --accent-color: #3498db; /* Bright Blue */
  --success-color: #27ae60; /* Green */
  --warning-color: #f39c12; /* Yellow-Orange */
  --error-color: #e74c3c; /* Red */
  --light-gray: #ecf0f1; /* Very Light Gray */
  --medium-gray: #bdc3c7; /* Medium Gray */
  --dark-gray: #7f8c8d; /* Dark Gray */
  --background-color: #f4f6f9; /* Light Background */
  --text-color: #333;
  --card-background: #ffffff;
  --border-radius: 8px;
}

.modal-header {
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
  margin-bottom: 25px;
}
.modal-title {
  margin: 0;
  color: var(--primary-color);
  font-size: 1.8em;
  display: flex;
  align-items: center;
}
.modal-title i {
  margin-right: 12px;
  color: var(--accent-color);
}

/* Student Detail Modal Specifics */
.student-details-modal .student-info-header {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
  font-size: 1.1em;
}
.student-details-modal .student-info-header div {
  background-color: var(--light-gray);
  padding: 10px 15px;
  border-radius: 4px;
}
.student-details-modal .student-info-header strong { color: var(--primary-color); }
.student-details-modal hr { border: 0; border-top: 1px solid #eee; margin: 25px 0; }

.modal-chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}
.modal-chart-container {
  background-color: #f9f9f9;
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
.modal-chart-container h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.1em;
  color: var(--secondary-color);
}

/* Subject Detail Modal Specifics */
.subject-details-modal .summary-cards {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Smaller cards */
}

/* Footer */
footer {
  text-align: center;
  padding: 25px;
  margin-top: 40px;
  color: var(--dark-gray);
  font-size: 0.9em;
  border-top: 1px solid var(--light-gray);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container { padding: 10px; }
  header h1 { font-size: 1.8em; }
  header p { font-size: 1em; }
  .tab-button { padding: 12px 15px; font-size: 1em; }
  .card { padding: 20px; }
  .fetch-options, .file-actions, .chart-row, .modal-chart-row, .summary-cards, .student-details-modal .student-info-header {
      grid-template-columns: 1fr; /* Stack elements */
  }
  .modal-content { width: 95%; margin: 5% auto; max-height: 85vh; padding: 20px; }
  .modal-title { font-size: 1.5em; }
  .close { font-size: 28px; top: 10px; right: 15px; }
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
      text-align: left; /* Align left on small screens */
      float: none;
      margin-bottom: 10px;
  }
  .dt-buttons { float: none; text-align: left; margin-top: 10px; }
  .modal-summary-cards {
      grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); /* Allow more flexible wrapping */
      gap: 10px; /* Smaller gap on mobile */
  }
  .summary-card-item .value {
      font-size: 1.4em; /* Slightly smaller value on small screens */
  }
  .summary-card-item h4 {
      font-size: 0.8em; /* Smaller title on mobile */
  }
  .dashboard-charts-grid-single-col {
      gap: 15px; /* Reduce gap on smaller screens */
  }
}

@media (max-width: 480px) {
  header h1 { font-size: 1.5em; }
  .tab-button { padding: 10px; font-size: 0.9em; }
  .btn { padding: 10px 18px; font-size: 0.9em; }
  .modal-title { font-size: 1.3em; }
}

/* Chart Styles */
.chart-row {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 20px; /* Space between charts in a row */
    margin-bottom: 30px;
}

.chart-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex: 1; /* Make containers flexible */
    min-width: 300px; /* Minimum width before wrapping */
    position: relative; /* Needed for absolute positioning if used */
}

.chart-box { /* Specific style for boxes that should be equal width in a row */
    flex-basis: calc(50% - 10px); /* Default to 2 columns, accounting for gap */
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px; /* Add some space below header */
    flex-wrap: wrap; /* Allow controls to wrap on smaller screens */
    gap: 10px; /* Add gap between title and controls when they wrap */
}

.chart-header h3 {
    margin: 0; /* Remove default margin from h3 */
    flex-grow: 1; /* Allow title to take available space */
    /* Removed margin-right, using gap on parent now */
    min-width: 0; /* Allow title to shrink if needed */
    flex-basis: 200px; /* Give title a base width before growing/shrinking */
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 5px; /* Space between control elements */
    flex-shrink: 0; /* Prevent controls container from shrinking */
    flex-wrap: nowrap; /* Keep controls themselves on one line */
}

/* Style for the chart type select dropdown */
.chart-control-select {
    padding: 4px 8px; /* Match button padding */
    font-size: 0.8rem; /* Match btn-tiny font size */
    border: 1px solid #ccc;
    border-radius: 4px; /* Match button border-radius */
    background-color: #fff;
    cursor: pointer;
    height: 28px; /* Match btn-tiny height */
    line-height: 1.5; /* Adjust line height */
    min-width: 80px; /* Give it a minimum width */
    flex-shrink: 0; /* Prevent shrinking too much */
}

/* Ensure tiny buttons in chart controls align well */
.chart-controls .btn-tiny {
    height: 28px; /* Explicit height */
    padding-top: 0;
    padding-bottom: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Style for chart container when in fullscreen */
.chart-container:fullscreen,
.modal-chart-container:fullscreen {
    background-color: white; /* Ensure background is white */
    padding: 20px; /* Add some padding */
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    display: flex; /* Use flexbox to help center/align canvas */
    flex-direction: column; /* Stack header and canvas vertically */
}

/* Ensure canvas inside the fullscreen container resizes appropriately */
.chart-container:fullscreen canvas,
.modal-chart-container:fullscreen canvas {
    /* Chart.js responsive should handle this, but explicitly set if needed */
    max-width: 100%;
    max-height: calc(100% - 50px); /* Adjust based on header height if header is visible */
    /* Or let Chart.js handle it if responsive: true and maintainAspectRatio: false */
}

/* Optional: Hide header in fullscreen if desired */
/*
.chart-container:fullscreen .chart-header,
.modal-chart-container:fullscreen .chart-header {
    display: none;
}

.chart-container:fullscreen canvas,
.modal-chart-container:fullscreen canvas {
     max-height: 100%;
}
*/

/* Modal Chart Styles (if needed) */
/* ... */

/* Modal Fullscreen Toggle Button */
.modal-fullscreen-btn {
    position: absolute;
    top: 15px;
    right: 50px; /* Position to the left of the close button */
    font-size: 1.2em;
    color: #aaa;
    cursor: pointer;
    border: none;
    background: none;
    transition: color 0.2s;
    z-index: 1051; /* Ensure it's above modal content */
}
.modal-fullscreen-btn:hover, 
.modal-fullscreen-btn:focus { 
    color: #333; 
    text-decoration: none; 
}

/* Fullscreen Modal State */
.modal.fullscreen {
    padding: 0;
    overflow: hidden;
}
.modal.fullscreen .modal-content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    padding: 40px 20px 20px; /* Add more top padding for buttons */
    border-radius: 0;
    box-shadow: none;
}

/* Adjust position of close button in fullscreen mode */
.modal.fullscreen .close,
.modal.fullscreen .modal-fullscreen-btn {
    position: fixed;
}

/* Animation for transitioning to/from fullscreen */
.modal .modal-content {
    transition: all 0.3s ease-in-out;
}

/* Modal Close Button */
.modal .close {
    position: absolute;
    top: 15px; /* Align vertically with fullscreen button */
    right: 20px;
    font-size: 1.5em; /* Adjust size if needed */
    color: #aaa;
    cursor: pointer;
    border: none;
    background: none;
    transition: color 0.2s;
    z-index: 1051; /* Ensure it's above modal content */
    line-height: 1; /* Ensure consistent vertical alignment */
    padding: 0; /* Remove default padding if any */
}
.modal .close:hover,
.modal .close:focus {
    color: #333;
    text-decoration: none;
}

/* Modal Fullscreen Toggle Button */
.modal-fullscreen-btn {
    position: absolute;
    top: 15px; /* Align vertically with close button */
    right: 55px; /* Position slightly more to the left of the close button */
    font-size: 1.2em; /* Adjust size if needed */
    color: #aaa;
    cursor: pointer;
    border: none;
    background: none;
    transition: color 0.2s;
    z-index: 1051; /* Ensure it's above modal content */
    line-height: 1; /* Ensure consistent vertical alignment */
    padding: 0; /* Remove default padding */
}
.modal-fullscreen-btn:hover,
.modal-fullscreen-btn:focus {
    color: #333;
    text-decoration: none;
}

/* Fullscreen Modal State */
.modal.fullscreen {
    padding: 0;
    overflow: hidden;
}
.modal.fullscreen .modal-content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    padding: 50px 20px 20px; /* Increase top padding for buttons */
    border-radius: 0;
    box-shadow: none;
}

/* Adjust position of close button in fullscreen mode */
.modal.fullscreen .close,
.modal.fullscreen .modal-fullscreen-btn {
    position: fixed; /* Use fixed positioning in fullscreen */
    top: 15px; /* Keep consistent top position */
}
.modal.fullscreen .close {
    right: 20px;
}
.modal.fullscreen .modal-fullscreen-btn {
    right: 55px;
}

/* Modal title with controls alignment */
.modal-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    width: 100%;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.modal-title-text {
    flex: 1;
    margin-right: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-title-controls {
    display: flex;
    gap: 8px; /* Adjust gap if needed for icons */
    align-items: center;
}

/* Common styles for modal control buttons (Close, Fullscreen) - FontAwesome */
.modal-control-btn {
    /* Remove native button styles */
    /* border: 1px solid #ccc; */
    /* background-color: #f0f0f0; */
    /* font-weight: bold; */
    /* color: #555; */

    /* Restore icon-based styles */
    font-size: 1.3em; /* Adjust icon size */
    color: #aaa;
    cursor: pointer;
    border: none;
    background: none;
    transition: color 0.2s;
    line-height: 1;
    padding: 5px; /* Padding around the icon */
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-control-btn:hover,
.modal-control-btn:focus {
    color: #333; /* Darker color on hover */
    text-decoration: none;
    outline: none;
    /* background-color: transparent; */ /* Ensure no background change */
    /* border-color: transparent; */ /* Ensure no border change */
}

/* Specific styles (adjust icon sizes if needed) */
.modal .close {
    font-size: 1.4em; /* Slightly larger 'times' icon */
}

.modal-fullscreen-btn {
    font-size: 1.1em; /* Slightly smaller 'expand/compress' icons */
}

/* Ensure search modal close button gets styled if it has .modal-control-btn */
#globalSearchModal .modal-control-btn.close {
    /* Add specific overrides if needed, but common styles should apply */
    position: absolute; /* Example: Override if it's positioned differently */
    top: 10px;
    right: 15px;
}

/* Fullscreen Modal State */
/* ...existing code... */

/* Common styles for modal control buttons */
.modal-control-btn {
    /* ... existing styles ... */
    display: inline-flex; /* Helps center content like Material Icons */
    align-items: center;
    justify-content: center;
    vertical-align: middle; /* Align buttons better if heights differ */
}

/* Specific adjustments for Material Icons if 'material' set is used */
.modal-control-btn .material-icons {
    font-size: 1.2em; /* Adjust size for Material Icons */
    /* Material Icons might need slight vertical alignment adjustment */
    vertical-align: text-bottom;
}

/* Adjust padding if native symbols look too cramped */
/* Example for native set: */
/* .modal-control-btn { padding: 2px 6px; } */

/* Common styles for modal control buttons */
.modal-control-btn {
    /* ... existing styles ... */
    /* Ensure buttons can contain the span */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px; /* Adjust padding if needed */
    min-width: 26px; /* Ensure minimum size for icon */
    min-height: 26px; /* Increased minimum height */
}

/* Specific adjustments for jQuery UI Icons if 'jqueryui' set is used */
/* The .ui-icon class comes from jQuery UI's CSS */
.modal-control-btn .ui-icon {
    /* Override default text indent if necessary */
    text-indent: 0;
    /* Ensure it's displayed */
    display: block;
    /* jQuery UI icons are typically 16x16 via background image */
    /* No size override needed unless you want larger icons and have custom CSS */
    margin: auto; /* Center the icon span if button is larger */
}

/* ...existing code... */

/* Common styles for modal control buttons */
.modal-control-btn {
    /* ... existing styles ... */
    padding: 7px; /* Increased padding for larger clickable area */
    min-width: 32px; /* Increased minimum size to fit larger icons */
    min-height: 32px; /* Increased minimum height */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Specific adjustments for jQuery UI Icons if 'jqueryui' set is used */
.modal-control-btn .ui-icon {
    /* Override default text indent if necessary */
    text-indent: 0;
    /* Ensure it's displayed */
    display: block;
    /* Increase the icon size using transform */
    transform: scale(1.5); /* Make icons 50% larger */
    margin: auto; /* Center the icon */
}

/* Adjust position of close button in fullscreen mode to accommodate larger buttons */
.modal.fullscreen .close {
    right: 22px; /* Slightly adjust position */
}

.modal.fullscreen .modal-fullscreen-btn {
    right: 60px; /* Adjust position to maintain spacing between buttons */
}

/* Chart Header Controls */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.chart-header h3 {
    margin: 0;
    flex-grow: 1;
    min-width: 100px;
    flex-basis: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Improved chart controls container */
.chart-controls {
    display: flex;
    align-items: center;
    gap: 6px; /* Increase gap slightly between items */
    flex-shrink: 0;
    flex-wrap: nowrap;
    max-width: 190px; /* Limit maximum width to prevent overflow */
}

/* Style for the chart type select dropdown */
.chart-control-select {
    padding: 2px 6px; /* Slightly smaller padding */
    font-size: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    height: 28px;
    line-height: 1.5;
    min-width: 70px; /* Slightly smaller min-width */
    max-width: 120px; /* Maximum width to prevent dropdown from growing too large */
    flex-shrink: 1; /* Allow dropdown to shrink if needed */
    flex-grow: 0; /* Don't let dropdown grow larger than needed */
}

/* Ensure fullscreen button has proper size and doesn't grow */
.chart-controls .fullscreen-chart-btn {
    height: 28px;
    width: 32px; /* Set explicit width */
    padding: 3px;
    flex-shrink: 0; /* Prevent button from shrinking */
    flex-grow: 0; /* Prevent button from growing */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Modal-specific adjustments */
.modal .chart-controls {
    margin-left: auto; /* Push controls to the right */
}

/* Fullscreen Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.85); /* Semi-transparent background */
    z-index: 9999; /* Ensure it's above everything else */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
    opacity: 0;
    visibility: hidden; /* Start hidden */
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db; /* Blue color for the spinner */
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    margin-bottom: 20px;
}

.loading-message {
    font-size: 1.2rem;
    color: #333;
    margin-top: 15px;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Disable scrolling when overlay is active */
body.loading-active {
    overflow: hidden;
}

/* --- DataTables Specific Styles --- */
.dataTables_wrapper {
    position: relative;
    clear: both;
    padding-top: 10px; /* Space above controls */
}

/* Top section: Length menu, Filter, Buttons */
.dataTables_wrapper .top {
    display: flex;
    justify-content: space-between; /* Distribute space */
    align-items: center;
    flex-wrap: wrap; /* Allow items to wrap to the next line */
    margin-bottom: 15px;
    gap: 10px 15px; /* Row gap, Column gap */
}

/* Length menu */
.dataTables_length {
    display: flex;
    align-items: center;
    gap: 5px;
    /* Removed flex-grow: 1; to prevent it from taking too much space */
}
/* ... existing length styles ... */

/* Filter (Search) */
.dataTables_filter {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto; /* Push filter towards the right initially */
    /* Removed flex-grow: 1; */
}
/* ... existing filter styles ... */
/* On smaller screens, allow filter to take more width if buttons wrap */
@media (max-width: 767px) {
    .dataTables_filter {
        margin-left: 0; /* Reset margin */
        width: 100%; /* Allow filter to take full width when wrapped */
    }
    .dataTables_filter input {
        width: 100%; /* Make input fill the available space */
        margin-left: 0;
    }
    .dataTables_filter label {
        width: auto; /* Let label take its natural width */
    }
}


/* Buttons */
.dt-buttons {
    display: flex; /* Use flex for button alignment within the container */
    flex-wrap: wrap; /* Allow buttons themselves to wrap */
    gap: 5px; /* Space between buttons */
    margin-left: 10px; /* Add some space from the filter */
    /* Removed text-align: right; */
    /* Removed margin-left: auto; - let flexbox handle positioning */
}
.dt-buttons .btn {
    margin-left: 0; /* Reset individual button margin, use gap instead */
    /* ... existing btn styles ... */
}
/* Ensure buttons container doesn't shrink excessively */
.dt-buttons {
    flex-shrink: 0;
}


/* Bottom section: Info, Pagination */
.dataTables_wrapper .bottom {
    display: flex;
    justify-content: space-between; /* Distribute space */
    align-items: center;
    flex-wrap: wrap; /* Allow items to wrap */
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    gap: 10px 15px; /* Row gap, Column gap */
}

/* Info text */
.dataTables_info {
    padding-top: 0.3em;
    font-size: 0.9em;
    color: #555;
    flex-grow: 1; /* Allow info to take available space */
    flex-shrink: 0; /* Prevent shrinking */
    text-align: left; /* Align left */
}

/* Pagination */
.dataTables_paginate {
    padding-top: 0.25em;
    margin-left: auto; /* Push to the right */
    flex-shrink: 0; /* Prevent shrinking */
    text-align: right; /* Align buttons right */
}
/* ... existing pagination button styles ... */

/* Responsive adjustments for DataTables controls stacking (already present, ensure consistency) */
@media (max-width: 768px) {
    /* Top section stacking */
    .dataTables_wrapper .top {
        flex-direction: column; /* Stack vertically */
        align-items: stretch; /* Stretch items full width */
    }
    .dataTables_length,
    .dataTables_filter,
    .dt-buttons {
        width: 100%; /* Make each control take full width */
        margin-left: 0; /* Reset margins */
        justify-content: center; /* Center content within each control block */
        margin-bottom: 10px; /* Add space between stacked controls */
    }
     .dataTables_filter {
        order: 1; /* Optional: Put search below length */
    }
    .dt-buttons {
        order: 2; /* Optional: Put buttons last in top section */
        justify-content: flex-start; /* Align buttons left when stacked */
    }

    /* Bottom section stacking */
    .dataTables_wrapper .bottom {
        flex-direction: column; /* Stack vertically */
        align-items: center; /* Center items */
    }
    .dataTables_info,
    .dataTables_paginate {
        width: 100%;
        text-align: center; /* Center text/buttons */
        margin-left: 0; /* Reset margin */
        margin-bottom: 10px; /* Add space */
    }
     .dataTables_paginate {
        order: 1; /* Put pagination below info */
    }
}

/* --- Student Detail Modal --- */
/* Style for the new header card layout - NOW GENERIC */
.modal-summary-cards { /* Renamed from .modal-student-summary-cards */
    display: grid;
    /* Adjust columns for desired layout, e.g., 3 or 4 columns */
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* Adjusted min width */
    gap: 10px; /* Space between cards */
    margin-bottom: 20px; /* Space below the cards */
    padding: 10px;
    background-color: #f8f9fa; /* Light background for the header area */
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

.summary-card-item { /* Renamed from .student-detail-card */
    background-color: #fff;
    padding: 10px 12px; /* Slightly smaller padding */
    border-radius: 4px;
    border: 1px solid #dee2e6;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    display: flex; /* Use flex for internal alignment */
    flex-direction: column; /* Stack title and value vertically */
    position: relative; /* Needed for absolute positioning of copy button */
    text-align: center; /* Center text in cards */
}

.summary-card-item h4 { /* Adjusted selector */
    margin: 0 0 5px 0; /* Space below title */
    font-size: 0.8em; /* Smaller title */
    color: var(--secondary-color); /* Use secondary color for title */
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center; /* Center title content */
    gap: 5px; /* Space between icon and text */
    text-transform: uppercase; /* Uppercase titles */
}
.summary-card-item h4 i { /* Adjusted selector */
    color: var(--primary-color); /* Icon color */
    font-size: 0.9em; /* Slightly smaller icon */
    margin-right: 3px; /* Space after icon */
}

.summary-card-item .value { /* Adjusted selector */
    font-size: 1.2em; /* Slightly larger value */
    font-weight: bold;
    color: var(--text-color);
    word-break: break-word; /* Prevent long names/enrollments from overflowing */
}
.summary-card-item .value .unit { /* Style for units like % */
    font-size: 0.7em;
    font-weight: normal;
    margin-left: 2px;
    color: var(--secondary-color);
}


/* Specific style for enrollment card in student modal */
.enrollment-card { /* Keep this specific class */
    /* padding-right: 40px; Make space for the button */
     padding-right: 0px; /* Make space for the button */
}
.enrollment-card .copy-button {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    padding: 3px 6px; /* Smaller button padding */
    font-size: 0.8em; /* Smaller icon */
}

/* --- Subject Detail Modal --- */
/* Remove old summary card styles if they conflict */
/* #modalSubjectSummaryCards { ... } */
/* .dashboard-card { ... } */ /* Remove if only used here */

/* Style for the metrics table */
#modal-subject-metrics-table {
    margin-bottom: 20px; /* Space below metrics table */
}
#modal-subject-metrics-table td:first-child {
    font-weight: 600; /* Make metric names bold */
    width: 30%; /* Allocate space for metric names */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    /* ... existing responsive styles ... */

    /* Adjust summary cards for smaller screens */
    .modal-summary-cards { /* Adjusted selector */
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* Allow more flexible wrapping */
    }
    .summary-card-item .value { /* Adjusted selector */
        font-size: 1.1em; /* Slightly smaller value on small screens */
    }

    /* Stack modal charts (Only applies to student modal now) */
    #studentDetailModal .modal-chart-grid { /* Target student modal specifically */
        grid-template-columns: 1fr;
    }
    /* ... existing responsive styles ... */
}

/* --- DataTables Customization --- */
/* Style for action buttons in tables */
table.dataTable .btn-sm {
    padding: 0.2rem 0.4rem;
    font-size: 0.8em;
    margin: 0 2px; /* Add small margin between buttons if needed */
}
table.dataTable .btn-sm i {
    margin-right: 3px;
}

/* Dashboard Chart Grid - Single Column */
.dashboard-charts-grid-single-col {
    display: grid;
    grid-template-columns: 1fr; /* Single column */
    gap: 25px; /* Keep the gap between charts */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    /* Ensure single column layout for charts on mobile (already handled by 1fr) */
    .dashboard-charts-grid-single-col {
        gap: 15px; /* Reduce gap on smaller screens */
    }

    /* Adjust action button size/padding if needed on mobile */
    table.dataTable .btn-sm {
        /* padding: 0.15rem 0.3rem; */
        /* font-size: 0.75em; */
    }
}

/* --- Print Specific Styles --- */
@media print {
    /* Hide everything except the modal being printed */
    body.printing-modal > *:not(.modal-being-printed) {
        display: none !important;
        visibility: hidden !important;
    }

    /* Ensure the modal being printed is visible */
    body.printing-modal .modal-being-printed {
        display: block !important;
        visibility: visible !important;
        position: absolute !important; /* Override fixed positioning */
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important; /* Allow content to flow */
        background-color: #fff !important; /* Ensure white background */
        border: none !important;
        box-shadow: none !important;
        z-index: 9999 !important;
    }

    /* Style the modal content for printing */
    body.printing-modal .modal-being-printed .modal-content {
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 10px !important; /* Add some padding */
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* Hide modal header controls (close, fullscreen, print buttons) */
    body.printing-modal .modal-being-printed .modal-title-controls {
        display: none !important;
    }

    /* Hide the separate print button container during print */
    body.printing-modal .modal-being-printed .modal-print-container {
        display: none !important;
    }

    /* Hide DataTables controls (length, filter, pagination, info) within the printed modal */
    body.printing-modal .modal-being-printed .dataTables_length,
    body.printing-modal .modal-being-printed .dataTables_filter,
    body.printing-modal .modal-being-printed .dataTables_info,
    body.printing-modal .modal-being-printed .dataTables_paginate,
    body.printing-modal .modal-being-printed .dt-buttons { /* Hide export buttons too */
        display: none !important;
    }

    /* Adjust modal header padding */
     body.printing-modal .modal-being-printed .modal-header {
        padding-bottom: 10px;
        border-bottom: 1px solid #ccc; /* Add a separator */
        margin-bottom: 0; /* Remove margin if print container is hidden */
    }
     body.printing-modal .modal-being-printed .modal-title {
        padding-right: 0; /* Remove padding reserved for controls */
    }

    /* Ensure charts render reasonably */
    body.printing-modal .modal-being-printed .chart-container,
    body.printing-modal .modal-being-printed .modal-chart-container {
        width: 100% !important;
        height: auto !important; /* Let height adjust */
        max-width: 95%; /* Prevent slight overflow */
        margin: 15px auto; /* Center charts */
        page-break-inside: avoid; /* Try to keep charts on one page */
    }
    body.printing-modal .modal-being-printed canvas {
        max-width: 100%;
        height: auto !important;
    }

    /* Ensure tables print well */
    body.printing-modal .modal-being-printed .table-responsive {
        overflow: visible !important; /* Show full table */
    }
    body.printing-modal .modal-being-printed table {
        width: 100% !important;
        font-size: 9pt !important; /* Smaller font for print */
        page-break-inside: auto; /* Allow tables to break across pages */
    }
     body.printing-modal .modal-being-printed th,
     body.printing-modal .modal-being-printed td {
        padding: 4px 6px !important;
    }
    /* Hide DataTables controls */
    body.printing-modal .modal-being-printed .dataTables_wrapper .top,
    body.printing-modal .modal-being-printed .dataTables_wrapper .bottom {
        display: none !important;
    }

    /* Style summary cards for print */
    body.printing-modal .modal-being-printed .modal-summary-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Adjust columns for print */
        gap: 10px;
    }
     body.printing-modal .modal-being-printed .summary-card-item {
        box-shadow: none;
        border: 1px solid #eee;
        page-break-inside: avoid;
    }
     body.printing-modal .modal-being-printed .summary-card-item .value {
        font-size: 1.2em; /* Slightly smaller value */
    }
     body.printing-modal .modal-being-printed .summary-card-view-btn,
     body.printing-modal .modal-being-printed .copy-button {
        display: none; /* Hide interactive buttons */
    }

    /* General print adjustments */
    a { text-decoration: none; color: inherit; } /* Avoid underlined links */
    hr.section-divider {
        border-top: 1px solid #ccc;
        margin: 20px 0;
    }
}

/* --- Modal Styles --- */
/* Container for the print button below the header */
.modal-print-container {
    padding: 10px 20px 0; /* Add padding above/below */
    text-align: right; /* Align button to the right */
    border-bottom: 1px solid var(--border-color); /* Optional separator */
    margin-bottom: 15px; /* Space below the container */
}

/* Style for the print button itself */
.modal-print-button {
    /* Use existing btn styles or add specific ones */
    /* Example: */
    /* padding: 5px 10px; */
    /* font-size: 0.9em; */
}
.modal-print-button i {
    margin-right: 5px;
}

/* --- Global Search Modal Adjustments --- */
/* Increase specificity and set width */
body #globalSearchModal .modal-dialog {
    max-width: 90%; /* Increase modal width (e.g., 90%) */
    width: 90%;     /* Set width explicitly */
    /* Or use fixed pixel values: */
    /* max-width: 1200px; */
    /* width: 1200px; */
    margin-left: auto; /* Ensure centering */
    margin-right: auto; /* Ensure centering */
}

/* Ensure modal content allows scrolling if table is too wide/long */
#globalSearchModal .modal-body {
    max-height: 75vh; /* Adjust height if needed */
    overflow-y: auto; /* Enable vertical scroll */
    overflow-x: auto; /* Enable horizontal scroll if content overflows */
}

/* Search Options Radio Buttons */
.search-options {
    margin: 10px 0;
}

.radio-option {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 0.95em;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.radio-option:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

.radio-option input[type="radio"] {
    margin-right: 8px;
    width: auto;
    padding: 0;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.radio-option .checkmark {
    margin-right: 8px;
}

/* Global Search Results Enhancements */
.search-result-file-group {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 15px;
    overflow: hidden;
}

.search-result-file-group .file-header {
    background-color: #f8f9fa;
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-result-file-group .file-source-badge {
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.search-result-file-group .file-source-badge.preset {
    background-color: rgba(52, 152, 219, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.search-result-file-group .file-source-badge.user {
    background-color: rgba(39, 174, 96, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(39, 174, 96, 0.3);
}

#global-search-results .table {
    margin-bottom: 0;
}

#global-search-results .table th {
    background-color: var(--primary-color);
    color: white;
    font-size: 0.9em;
    padding: 8px 12px;
}

#global-search-results .table td {
    padding: 8px 12px;
    font-size: 0.9em;
    vertical-align: middle;
}

.load-file-from-search-btn {
    font-size: 0.8em;
    padding: 4px 8px;
}

/* Advanced Search Form Styles */
.advanced-search-section {
  margin-top: 20px;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
  border: 1px solid #e9ecef;
}

.advanced-search-section h6 {
  margin-bottom: 15px;
  color: var(--primary-color);
  font-weight: 600;
  font-size: 1.1em;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -10px;
}

.form-row .form-group {
  flex: 1;
  min-width: 200px;
  padding: 0 10px;
  margin-bottom: 15px;
}

.form-row .form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.9em;
}

.form-row .form-group input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font-size: 0.9em;
  transition: border-color 0.3s ease;
}

.form-row .form-group input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Search Type Radio Buttons */
.search-type-options {
  display: flex;
  gap: 20px;
  margin: 15px 0;
  align-items: center;
}

.search-type-options label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95em;
}

.search-type-options input[type="radio"] {
  margin-right: 8px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent-color);
}

/* Clear Filters Button */
.btn-clear-filters {
  background-color: var(--medium-gray);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.3s ease;
  margin-left: 10px;
}

.btn-clear-filters:hover {
  background-color: var(--dark-gray);
}

/* File Source Badges */
.file-source-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 500;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.file-source-badge.preset-data {
  background-color: #e3f2fd;
  color: #1976d2;
  border: 1px solid #bbdefb;
}

.file-source-badge.user-data {
  background-color: #f3e5f5;
  color: #7b1fa2;
  border: 1px solid #e1bee7;
}

/* Modal Size Adjustments for Advanced Search */
.modal-dialog.modal-lg {
  max-width: 900px;
}

.modal-dialog.modal-advanced-search {
  max-width: 1000px;
}

/* Responsive Design for Advanced Search */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
  }
  
  .form-row .form-group {
    min-width: 100%;
    padding: 0;
  }
  
  .search-type-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .modal-dialog.modal-advanced-search {
    max-width: 95%;
    margin: 10px auto;
  }
}

/* Search Results - Student Links */
.student-search-result-link {
  color: #007bff !important;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.2s ease;
}

.student-search-result-link:hover {
  color: #0056b3 !important;
  text-decoration: none;
}

.student-search-result-link:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Search Results Table Styling */
.search-result-file-group table {
  margin-bottom: 0;
}

.search-result-file-group .table-sm th,
.search-result-file-group .table-sm td {
  padding: 0.3rem;
  vertical-align: middle;
}

.search-result-file-group .table-sm th {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
}

.search-result-file-group .table-sm td {
  border-top: 1px solid #dee2e6;
}

/* Actions column styling */
.search-result-file-group .table-sm td:last-child {
  text-align: center;
  white-space: nowrap;
}

/* === Permalink Share Dialog Styles === */
.permalink-share-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000; /* Higher than modals */
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.permalink-dialog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.permalink-dialog-content {
    position: relative;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    margin: 0 auto;
    animation: slideIn 0.4s ease-out;
}

.permalink-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.permalink-dialog-header h5 {
    margin: 0;
    font-size: 1.3em;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.permalink-dialog-header h5 i {
    color: var(--accent-color);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5em;
    color: #aaa;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
}

.btn-close:hover {
    color: #333;
    background-color: #f0f0f0;
}

.permalink-dialog-body {
    padding: 20px 25px 25px;
}

.permalink-dialog-body p {
    margin: 0 0 15px 0;
    color: var(--secondary-color);
    font-size: 1em;
}

.input-group {
    display: flex;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background-color: white;
}

.input-group .form-control {
    flex: 1;
    border: none;
    padding: 12px 15px;
    font-size: 0.95em;
    background-color: #f8f9fa;
    color: var(--text-color);
    outline: none;
    font-family: monospace;
}

.input-group .btn {
    border: none;
    border-radius: 0;
    padding: 12px 20px;
    font-size: 0.9em;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.input-group .btn:hover {
    transform: none; /* Override default button hover transform */
    box-shadow: none; /* Override default button hover shadow */
}

/* Share Button Styles */
.share-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s, transform 0.2s;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.share-button:hover {
    background-color: #218838;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.share-button i {
    font-size: 1em;
}

/* Share button variants */
.share-button.btn-tiny {
    padding: 4px 8px;
    font-size: 0.8em;
    gap: 4px;
}

.share-button.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
    gap: 5px;
}

/* Modal share button positioning */
.modal-share-btn {
    position: absolute;
    top: 15px;
    right: 90px; /* Position to the left of fullscreen button */
    font-size: 1.1em;
    color: #28a745;
    cursor: pointer;
    border: none;
    background: none;
    transition: color 0.2s;
    z-index: 1051;
    padding: 5px;
    border-radius: 3px;
}

.modal-share-btn:hover {
    color: #218838;
    background-color: rgba(40, 167, 69, 0.1);
}

/* Dashboard share button */
.dashboard-share-btn {
    background-color: var(--success-color);
    color: white;
}

.dashboard-share-btn:hover {
    background-color: #219a52;
}

/* Adjust modal control button positioning when share button is present */
.modal.fullscreen .modal-share-btn {
    position: fixed;
    top: 15px;
    right: 90px;
}

.modal.fullscreen .modal-fullscreen-btn {
    right: 125px; /* Adjust to accommodate share button */
}

/* Responsive adjustments for share dialog */
@media (max-width: 768px) {
    .permalink-dialog-content {
        width: 95%;
        margin: 20px auto;
    }
    
    .permalink-dialog-header,
    .permalink-dialog-body {
        padding: 15px 20px;
    }
    
    .input-group {
        flex-direction: column;
        border-radius: 4px;
    }
    
    .input-group .form-control {
        border-bottom: 1px solid #ddd;
        border-radius: 4px 4px 0 0;
    }
    
    .input-group .btn {
        border-radius: 0 0 4px 4px;
        padding: 10px 15px;
    }
    
    /* Stack modal control buttons vertically on very small screens */
    @media (max-width: 480px) {
        .modal-title-controls {
            flex-direction: column;
            gap: 5px;
        }
        
        .modal-share-btn {
            position: static;
            order: 1;
        }
        
        .modal-fullscreen-btn {
            position: static;
            order: 2;
        }
        
        .close {
            position: static;
            order: 3;
        }
    }
}

/* Animation keyframes for dialog */
@keyframes slideIn {
    from {
        transform: translateY(-50px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Success/error states for copy feedback */
.copy-success {
    animation: copySuccess 0.3s ease;
}

@keyframes copySuccess {
    0% { background-color: var(--success-color); }
    100% { background-color: var(--accent-color); }
}

/* Notification toast styles (optional, for copy feedback) */
.permalink-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--success-color);
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 2001;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s;
    font-weight: 500;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* === End Permalink Share Dialog Styles === */

