/* ===================================================================
   CAPRED DATA SANDBOX - FULL THEME STYLESHEET
   =================================================================== */

/* -------------------------------------------------------------------
   Custom color scheme
   ------------------------------------------------------------------- */
:root {
  --primary-dark: #16486A;
  --primary-light: #2EA2DC;
  --accent-green: #41AF49;
  --accent-yellow: #F3B628;
  --light-gray: #f8f9fa;
  --dark-gray: #343a40;
  --text-dark: #343a40;
  --text-muted: #6c757d;
  --border-light: #e9ecef;
  --shadow-color: rgba(0,0,0,0.1);
}

/* -------------------------------------------------------------------
   FIXED SIDEBAR AND HEADER POSITIONING
   ------------------------------------------------------------------- */
#logout_btn{
  margin:auto!important;
}

.h4, h4 {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-dark) !important;
}

.main-sidebar,
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  overflow-y: auto;
  z-index: 1000;
}

.main-header {
  width: 100%;
  height: 50px;
  z-index: 1100;
}

.content-wrapper,
.right-side {
  margin-left: 250px;
  padding-top: 50px;
}

body {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* -------------------------------------------------------------------
   DASHBOARD HEADER
   ------------------------------------------------------------------- */
.main-header {
  background-color: var(--primary-gradient) !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.skin-blue .main-header .logo {
  background-color: #16486A;
}

.main-header .navbar {
  background-color: var(--primary-dark) !important;
}

.main-header .navbar-brand {
  color: white !important;
  font-weight: 600;
  font-size: 24px;
}

/* -------------------------------------------------------------------
   SIDEBAR STYLING
   ------------------------------------------------------------------- */
.main-sidebar {
  background-color: #1b557d !important;
}

.sidebar-menu > li > a {
  color: #ecf0f1 !important;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
}

.sidebar-menu > li > a:hover {
  background-color: var(--primary-light) !important;
  border-left: 3px solid var(--accent-green);
}

.sidebar-menu li.active > a {
  background-color: var(--accent-yellow) !important;
  color: var(--dark-gray) !important;
  font-weight: bold;
  border-left: 3px solid var(--accent-green);
}

.sidebar-menu .treeview-menu > li.active > a {
  background-color: #f3e2a3 !important;
  color: var(--dark-gray) !important;
  font-weight: 500;
}

.sidebar-menu .treeview-menu > li > a {
  color: #bdc3c7 !important;
  padding-left: 20px;
}

.sidebar-menu .treeview-menu > li > a:hover {
  background-color: rgba(46,162,220,0.3) !important;
}

/* -------------------------------------------------------------------
   CONTENT AREA & BOX STYLES
   ------------------------------------------------------------------- */
.content-wrapper {
  background-color: var(--light-gray) !important;
  min-height: 1500px !important;
}

.box {
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  border-top: none;
}

.box.box-primary {
  border-top: 3px solid var(--primary-light);
}

.box.box-success {
  border-top: 3px solid var(--accent-green);
}

.box.box-warning {
  border-top: 3px solid var(--accent-yellow);
}

.box-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
  color: white;
  border-radius: 8px 8px 0 0;
  padding: 15px;
}

.box-header .box-title {
  font-size: 18px;
  font-weight: 600;
}

/* -------------------------------------------------------------------
   BUTTONS & FORMS
   ------------------------------------------------------------------- */
.btn-primary {
  background-color: var(--primary-light);
  border-color: var(--primary-light);
  border-radius: 6px;
  color: white;
  font-weight: 500;
  transition: all 0.3s ease;
  margin: 0 auto;
  width: 100px;
  display: block;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(22,72,106,0.3);
}

.btn-success {
  background-color: var(--accent-green);
  border-color: var(--accent-green);
  border-radius: 6px;
}

.btn-warning {
  background-color: var(--accent-yellow);
  border-color: var(--accent-yellow);
  border-radius: 6px;
  color: var(--dark-gray);
}

.form-control {
  border-radius: 6px;
  transition: border-color 0.3s ease;
  width: 100%;
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 0.2rem rgba(46,162,220,0.25);
}

.form-group label {
  color: var(--primary-dark);
  font-weight: 500;
}

/* -------------------------------------------------------------------
   DATATABLE STYLING
   ------------------------------------------------------------------- */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
  color: var(--primary-dark);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border: 1px solid var(--primary-light);
  background: white;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  color: white !important;
  background: var(--primary-light) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  color: white !important;
  background: var(--light-gray) !important;
}

/* Comfortable table row spacing */
table.dataTable tbody td {
  padding: 10px 12px;
  vertical-align: middle;
}

table.dataTable tbody tr {
  height: auto;
}

/* -------------------------------------------------------------------
   FILTERS & RESET BUTTONS
   ------------------------------------------------------------------- */
.reset-btn {
  background: linear-gradient(135deg, var(--accent-yellow), #f39c12);
  border: none;
  color: var(--dark-gray);
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.3s ease;
  margin: 10px 5px;
}

.reset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(243,182,40,0.3);
}

.summary-text {
  font-size: 16px;
  line-height: 1.6;
  color: var(--dark-gray);
  background: white;
  padding: 20px;
  border-radius: 8px;
}

.filter-section {
  background: white !important;
  border-radius: 8px;
  padding: 0px 4px;
}

/* -------------------------------------------------------------------
   MODALS
   ------------------------------------------------------------------- */
.modal-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
  color: white;
  border-radius: 8px 8px 0 0;
}

.modal-content {
  border-radius: 8px;
  border: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* -------------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------------- */
@media (max-width: 768px) {
  .main-header .navbar-brand {
    font-size: 20px;
  }

  .box-header .box-title {
    font-size: 16px;
  }
}

.small-box {
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
}

/* -------------------------------------------------------------------
   PLOTS & TAB PANELS
   ------------------------------------------------------------------- */
.plot-container {
  background: var(--background-white);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px var(--shadow-color);
  border: 1px solid var(--border-light);
  margin: 15px 0;
  position: relative;
  overflow: hidden;
}

.tabbable {
  background-color: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

/* -------------------------------------------------------------------
   FAQ STYLES
   ------------------------------------------------------------------- */
.faq-search-container {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-light)) !important;
  margin-bottom: 20px;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

#faq_search {
  border: none;
  border-radius: 25px;
  padding: 12px 20px;
  font-size: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

#faq_search:focus {
  outline: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transform: translateY(-2px);
}

.no-results {
  text-align: center;
  padding: 40px;
  background: #f8f9fa;
  border-radius: 12px;
}

.faq-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  overflow: hidden;
  width: 100%;
}

.faq-item {
  border-bottom: 1px solid #e9ecef;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-question {
  padding: 20px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #e8efff;
  transition: background 0.3s ease;
  font-size: 17px;
}

.faq-question:hover {
  background: var(--light-gray);
}

.fa-question-circle {
  color: #41AF49;
  font-size: 16px;
}

.faq-answer {
  display: none;
  padding: 15px 20px 20px 46px;
  line-height: 1.6;
  color: #495057;
  background: #fafbff;
}

/* -------------------------------------------------------------------
   AUTHENTICATION UI
   ------------------------------------------------------------------- */
.login-container {
  max-width: 400px;
  margin: 100px auto;
  padding: 30px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background-color: #f9f9f9;
}

.login-title {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
}

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

.btn-auth {
  width: 100%;
  margin-bottom: 10px;
}

.auth-links {
  text-align: center;
  margin-top: 15px;
}

.auth-links a {
  color: #337ab7;
  text-decoration: none;
  margin: 0 10px;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* -------------------------------------------------------------------
   GRAPH BUILDER
   ------------------------------------------------------------------- */
.esquisse-title-container button.btn {
  display: inline;
  width: auto;
}

.esquisse-title {
  text-align: right;
  padding: 0px 50px 10px 0px;
}

/* -------------------------------------------------------------------
   LEAFLET MAPS
   ------------------------------------------------------------------- */
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
  height: 650px !important;
}

/* -------------------------------------------------------------------
   STICKY FILTER PANEL & SCROLLABLE TABLE
   ------------------------------------------------------------------- */
.fixed-filter {
  position: sticky;
  top: 65px;
  z-index: 100;
  background-color: var(--light-gray);
}

.fixed-filter .box {
  margin-bottom: 10px;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.scrollable-table {
  margin-top: 10px;
}

.dataTables_scrollBody {
  border-bottom: 1px solid var(--border-light);
}

/* Sticky table headers */
table.dataTable thead th {
  position: sticky;
  top: 0;
  background-color: #ffffff;
  z-index: 2;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* -------------------------------------------------------------------
   TABLE HEADER WRAPPING & AUTO HEIGHT
   ------------------------------------------------------------------- */
table.dataTable thead th {
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow: visible !important;
  text-overflow: clip !important;
  line-height: 1.3;
  vertical-align: middle;
  padding-top: 8px;
  padding-bottom: 8px;
  text-align: center;
}

table.dataTable thead tr {
  height: auto !important;
}

.dataTables_scrollHeadInner,
.dataTables_scrollHeadInner table {
  width: 100% !important;
  table-layout: fixed;
}

/* -------------------------------------------------------------------
   FIXED QUERY FILTERS (TRADE DATABASE)
   ------------------------------------------------------------------- */
.fixed-filter-box {
  position: sticky;
  top: 70px;
  z-index: 1050;
  background-color: var(--light-gray);
  transition: box-shadow 0.3s ease;
}

.fixed-filter-box .box {
  margin-bottom: 10px !important;
  box-shadow: 0 2px 8px var(--shadow-color);
  border-radius: 8px;
  background-color: #ffffff;
}

.scrollable-query-result {
  margin-top: 15px;
  line-height: 1.3;
}

body.scrolled .fixed-filter-box .box {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* -------------------------------------------------------------------
   BOX HEADER INTEGRATION & TABSET PANEL FIX
   ------------------------------------------------------------------- */
/*.tab-content .box {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}*/

.tab-content .box-header {
  background-color: var(--primary-light) !important;
  color: white !important;
  border-radius: 6px 6px 0 0 !important;
  padding: 8px 15px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.tab-content {
  margin-top: 15px !important;
}

.tab-content .box-body{
  margin-top: 10px !important;
  border: none !important;
  box-shadow: none !important;
}

.multi-tab .box{
  border: none !important;
  box-shadow: none !important;
}

/* -------------------------------------------------------------------
   DOWNLOAD BUTTON STYLING
   ------------------------------------------------------------------- */
.box .btn-success {
  background-color: var(--accent-green) !important;
  border: none !important;
  color: #ffffff !important;
  font-weight: 500;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 6px;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.box .btn-success:hover {
  background-color: #36a23d !important;
  transform: translateY(-1px);
}

.box .btn-success:active {
  background-color: #2c8b33 !important;
  transform: translateY(0);
}

.box > div > .btn-success {
  margin-top: 5px;
  margin-right: 5px;
}

.box div[style*="justify-content: flex-end"] .btn-success {
  margin-left: 5px;
}

.btn-success {
  white-space: nowrap;
}

/* -------------------------------------------------------------------
   TAB PANEL VISUAL POLISH
   ------------------------------------------------------------------- */

/* Slight lift effect when hovering over tab panels */
.tabbable:hover {
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  transform: translateY(-2px);
  transition: all 0.25s ease;
}

/* Smooth fade between tabs */
.nav-tabs > li > a {
  transition: background-color 0.25s ease, color 0.25s ease;
}

.nav-tabs > li.active > a {
  background-color: var(--primary-light) !important;
  color: white !important;
  border-radius: 6px 6px 0 0;
  font-weight: 600;
}

.nav-tabs > li > a:hover {
  background-color: var(--primary-light);
  color: #fff !important;
}

/* -------------------------------------------------------------------
   BOX SPACING CONSISTENCY
   ------------------------------------------------------------------- */

/* Add gentle padding below all boxes */
.tab-content .box {
  margin-bottom: 25px !important;
}

/* Ensure consistent spacing between tab panels */
.tab-pane {
  padding-top: 10px !important;
  padding-bottom: 15px !important;
}

/* Give breathing room between stacked plots or tables */
.plotOutput,
.dataTableOutput {
  margin-top: 10px;
  margin-bottom: 15px;
}

/* -------------------------------------------------------------------
   SMOOTH FADE-IN EFFECT FOR PLOTS AND TABLES
   ------------------------------------------------------------------- */
.plotOutput, .dataTableOutput {
  opacity: 0;
  animation: fadeIn 0.6s ease-in forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------------
   IMPROVED TAB PANEL LABEL READABILITY
   ------------------------------------------------------------------- */
.nav-tabs > li > a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dark);
}

.nav-tabs > li.active > a {
  font-weight: 600;
}

/* Make sure the table wrapper allows scroll while keeping header fixed */
.tab-content .box .dataTables_wrapper .dataTables_scrollBody {
  overflow-y: auto !important;
  max-height: 600px !important; /* Adjust as needed */
  border-bottom: 1px solid var(--border-light);
}

/* Keep the table header sticky within scroll area */
.tab-content .box table.dataTable thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 10;
  background-color: #ffffff !important;
  border-bottom: 2px solid var(--border-light);
}

/* Optional visual polish for better separation */
.tab-content .box table.dataTable thead th {
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Ensure the box around table has consistent spacing */
.tab-content .box .dataTables_wrapper {
  margin-top: 10px;
  margin-bottom: 10px;
}

/* News Summary Styling*/
.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
  margin-bottom: 30px;
}

.news-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(22, 72, 106, 0.15);
  transition: all 0.3s ease;
  border-left: 5px solid #2EA2DC; /* primary-light */
}

.news-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(22, 72, 106, 0.25);
  border-left-color: #41AF49; /* accent-green on hover */
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 15px;
  gap: 15px;
  flex-wrap: wrap;
}

.portfolio-badge {
  display: inline-block;
  padding: 6px 12px;
  background: linear-gradient(135deg, #16486A 0%, #2EA2DC 100%); /* primary-dark to primary-light */
  color: white;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.date-badge {
  padding: 6px 12px;
  background: #f0f0f0;
  color: #16486A; /* primary-dark for better contrast */
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.news-content {
  color: #333;
  line-height: 1.7;
}

.news-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.news-content li {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e8f4f8; /* subtle light blue */
}

.news-content li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.news-content strong {
  color: #16486A; /* primary-dark for emphasis */
}

.news-content a {
  color: #2EA2DC; /* primary-light */
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.news-content a:hover {
  color: #41AF49; /* accent-green on hover */
  text-decoration: underline;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(22, 72, 106, 0.15);
  grid-column: 1 / -1;
}

.no-results h3 {
  color: #16486A; /* primary-dark */
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
}