/* ===================================
   MAIN STYLES CSS
   Global styles, Bootstrap overrides, and base layout
   =================================== */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  /* Colors - Brand */
  --color-primary: #0d6efd;
  --color-success: #28a745;
  --color-success-alt: #198754;
  --color-danger: #dc3545;
  --color-warning: #ffc107;
  --color-info: #17a2b8;

  /* Colors - Backgrounds */
  --color-bg-body: #33424f;
  --color-bg-dark: #212529;
  --color-bg-card: #3e5160;
  --color-bg-header: #343a40;
  --color-bg-table-head: #253f47;
  --color-bg-gradient-start: #2c3e50;
  --color-bg-gradient-end: #34495e;

  /* Colors - Borders & Muted */
  --color-border: #495057;
  --color-border-light: #6c757d;
  --color-text-muted: #adb5bd;
  --color-text-light: #f8f9fa;

  /* Colors - Financial */
  --color-gain: #00b35c;
  --color-loss: #ef7156;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.25);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;

  /* Typography */
  --font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 8px;
}

/* ===== GLOBAL BASE STYLES ===== */
body,
html {
  background-color: var(--color-bg-body);
  font-family: var(--font-family);
  height: 100%;
  width: 100%;
}

/* ===== BOOTSTRAP OVERRIDES ===== */
.card-body {
  box-shadow: var(--shadow-sm);
  background-color: var(--color-bg-card);
  margin-top: 0;
}

.btn-outline-light:not(:disabled):not(.disabled).active:focus,
.btn-outline-light:not(:disabled):not(.disabled):active:focus,
.show > .btn-outline-light.dropdown-toggle:focus {
  box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5);
}

.table {
  box-shadow: var(--shadow-md) !important;
}

.table-hover tbody tr:hover td,
.table-hover tbody tr:hover th {
  background-color: rgb(255, 241, 230);
}

/* ===== GLOBAL LAYOUT ===== */
.main-content-spacing {
  margin-top: 86px;
  margin-left: 16px;
}

nav {
  margin-bottom: 26px;
}

.block-heading {
  margin-top: 40px;
}

/* ===== NAVIGATION STYLES ===== */
.navbar.navbar-light.navbar-expand-md.fixed-top.bg-dark.clean-navbar {
  padding-top: 0;
  padding-right: 0;
  padding-bottom: 0;
  padding-left: 5;
}

.nav-item-spacing {
  padding-right: 4px;
}

.nav-link-custom {
  color: rgba(255, 255, 255, 0.9);
}

/* ===== GLOBAL TABLE STYLES ===== */
thead {
  background-color: var(--color-bg-table-head);
  border: 32px;
  font-style: normal;
}

.table thead th {
  width: 167px;
}

/* ===== GLOBAL BUTTON STYLES ===== */
#add-stock-btn,
#add-portfolio-btn {
  border-color: rgb(255, 255, 255);
  color: rgb(255, 255, 255);
  background-color: rgb(38, 166, 154);
}

#close-modal-btn {
  border-color: rgb(255, 255, 255);
  color: rgb(255, 255, 255);
  background-color: rgb(254, 109, 115);
}

#trash-btn {
  border: none;
  background: transparent;
  color: #ff4846;
  outline: none;
  opacity: 0.6;
}

#trash-btn:hover {
  opacity: 1;
}

#cash-btn {
  border: none;
  background: transparent;
  color: #f704c6;
  outline: none;
  opacity: 0.6;
}

#cash-btn:hover {
  opacity: 1;
}

/* ===== GLOBAL FORM STYLES ===== */
#browsebutton {
  background-color: white;
}

#my-file-selector {
  display: none;
}

/* ===== GLOBAL ALERT STYLES ===== */
.alert-success {
  background-color: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.flash-toast.alert-success {
  background-color: var(--color-success);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  min-width: 300px;
  animation: slideInRight 0.3s ease-out;
}

.flash-toast.alert-success .btn-close {
  color: white;
  opacity: 0.8;
}

.flash-toast.alert-success i {
  color: white;
}

.alert-danger {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

/* ===== UTILITY CLASSES ===== */
.hidden-element {
  display: none;
}

.inline-form {
  display: inline;
}

.white-text {
  color: rgb(255, 255, 255);
}

.nowrap-text {
  white-space: nowrap;
}

.w-15 {
  width: 15% !important;
}

.w-20 {
  width: 20% !important;
}

/* ===== GLOBAL COLOR UTILITIES ===== */
td.num.r {
  color: var(--color-loss);
}

td.num.g {
  color: var(--color-gain);
}

.bg-custom-1 {
  background-color: #85144b;
}

.bg-custom-2 {
  background-image: linear-gradient(15deg, #13547a 0%, #80d0c7 100%);
}

/* ===== GLOBAL RESPONSIVE STYLES ===== */
@media (min-width: 768px) {
  #table-card {
    padding: 0 40px 0 40px;
  }
}

@media (min-width: 500px) {
  tbody {
    color: #181818;
  }
}

@media (max-width: 992px) {
  .mobileMenu {
    -webkit-transform: translateX(-100%);
    transform: translateX(-100%);
    position: fixed;
    top: 0px;
    bottom: 0;
    margin: auto;
    left: 0;
    -webkit-transition: all ease 0.25s;
    transition: all ease 0.25s;
  }

  .mobileMenu.open {
    -webkit-transform: translateX(0%);
    transform: translateX(0%);
  }

  .mobileMenu .navbar-nav {
    overflow-y: auto;
  }

  .overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
  }

  .overlay.open {
    display: block;
    z-index: 1029;
  }
}

/* ===== ACCESSIBILITY ===== */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  nav,
  footer,
  .btn,
  .modal,
  .widget-container,
  .flash-toast,
  .portfolio-nav {
    display: none !important;
  }

  body,
  html {
    background: white !important;
    color: black !important;
  }

  .card,
  .card-body,
  .portfolio-summary {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }

  .table {
    box-shadow: none !important;
    color: black !important;
  }

  .table-dark,
  .table-dark th {
    background-color: #f0f0f0 !important;
    color: black !important;
  }

  .main-content {
    margin-top: 0 !important;
  }
}

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