/* 
 * 📊 FINQUP PROFESSIONAL ACCOUNTING THEME
 * =========================================
 * 
 * Brand-aligned design system using ONLY green palette.
 * Glassmorphism + subtle animations + icy transparent look.
 * 
 * Brand Colors:
 *   Primary Green: #0D4D3B
 *   Dark Green:    #062F27
 *   Teal Accent:   #4FACAB
 * 
 * Font: DM Sans
 * 
 * @author FinqUP Design System
 * @version 2.0.0 — Brand Aligned
 */

/* ========================================
   GOOGLE FONTS — DM Sans
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap');

/* ========================================
   ROOT VARIABLES — FINQUP PALETTE
   ======================================== */

:root {
  /* === BRAND COLORS === */
  --brand-green: #0D4D3B;
  --brand-green-dark: #062F27;
  --brand-teal: #4FACAB;
  --brand-green-light: #3d7c3d;

  /* === CORE COLORS (green-only) === */
  --bg-primary: #ffffff;
  --bg-secondary: #f8faf9;
  --bg-tertiary: #f0f5f3;
  --bg-accent: #e2ede8;

  /* === TEXT COLORS === */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* === BORDER COLORS === */
  --border-light: #e2ede8;
  --border-medium: #cbd5d1;
  --border-strong: #94a3a0;

  /* === SEMANTIC COLORS (all green variants) === */
  --primary: #0D4D3B;
  --primary-dark: #062F27;
  --primary-light: rgba(13, 77, 59, 0.1);

  --success: #0D4D3B;
  --success-dark: #062F27;
  --success-light: rgba(13, 77, 59, 0.08);

  --warning: #0D4D3B;
  --warning-dark: #062F27;
  --warning-light: rgba(13, 77, 59, 0.06);

  /* Danger: muted ghost green — NOT red */
  --danger: rgba(13, 77, 59, 0.55);
  --danger-dark: rgba(6, 47, 39, 0.75);
  --danger-light: rgba(13, 77, 59, 0.06);

  /* === ACCOUNTING SPECIFIC === */
  --debit-color: #0D4D3B;
  --credit-color: #062F27;
  --balance-color: #4FACAB;
  --konto-color: #0D4D3B;

  /* === TYPOGRAPHY === */
  --font-primary: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-secondary: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;

  /* === SHADOWS (green-tinted) === */
  --shadow-sm: 0 1px 2px rgba(13, 77, 59, 0.04);
  --shadow-md: 0 4px 6px rgba(13, 77, 59, 0.06);
  --shadow-lg: 0 10px 15px rgba(6, 47, 39, 0.08);
  --shadow-xl: 0 20px 25px rgba(6, 47, 39, 0.1);

  /* === GLASSMORPHISM === */
  --glass-bg: linear-gradient(135deg,
      rgba(255, 255, 255, 0.01),
      rgba(200, 235, 235, 0.02),
      rgba(180, 220, 230, 0.01));
  --glass-blur: blur(6px) saturate(150%);
  --glass-border: 2px solid rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(6, 47, 39, 0.15),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 0 rgba(255, 255, 255, 0.1);

  /* Enhanced glass */
  --glass-bg-enhanced: linear-gradient(135deg,
      rgba(255, 255, 255, 0.18) 0%,
      rgba(236, 249, 246, 0.15) 100%);
  --glass-blur-enhanced: blur(22px) saturate(185%);
  --glass-shadow-enhanced: 0 18px 42px -14px rgba(6, 47, 39, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);

  /* === SPACING === */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* === BORDER RADIUS === */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
}

/* ========================================
   GLOBAL OVERRIDES
   ======================================== */

html.light,
html.light body,
.light {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

body {
  font-family: var(--font-primary) !important;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.text-white span,
.text-white svg,
button.text-white,
a.text-white,
.text-white {
  color: #ffffff !important;
}

/* ========================================
   SHINE ANIMATION (FinqUP Brand)
   ======================================== */

@keyframes finqup-shine {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

@keyframes finqup-subtle-glow {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(13, 77, 59, 0.15);
  }

  50% {
    box-shadow: 0 0 16px rgba(79, 172, 171, 0.25);
  }
}

/* ========================================
   TAILWIND OVERRIDES FOR BRAND THEME
   ======================================== */

/* Background overrides */
.bg-gray-900 {
  background-color: var(--bg-primary) !important;
}

.bg-gray-800 {
  background-color: var(--bg-secondary) !important;
}

.bg-gray-700 {
  background-color: var(--bg-tertiary) !important;
}

.bg-gray-600 {
  background-color: rgba(13, 77, 59, 0.55) !important;
  color: #ffffff !important;
}

/* Text color overrides */
.text-white {
  color: #ffffff !important;
}

.text-gray-200 {
  color: var(--text-primary) !important;
}

.text-gray-300 {
  color: var(--text-secondary) !important;
}

.text-gray-400 {
  color: var(--text-tertiary) !important;
}

.text-gray-500 {
  color: var(--text-tertiary) !important;
}

.text-gray-600 {
  color: var(--text-secondary) !important;
}

.text-gray-700 {
  color: var(--text-primary) !important;
}

.text-gray-800 {
  color: var(--text-primary) !important;
}

/* Dashboard specific text colors */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-primary) !important;
  font-family: var(--font-primary) !important;
}

/* Enhanced dashboard elements */
.enhanced-kpi-card h3,
.enhanced-kpi-card p,
.chart-container h3,
.chart-container p {
  color: var(--text-primary) !important;
}

/* Junior dashboard headers */
.junior-dashboard h2,
.junior-dashboard h3,
.junior-dashboard h4 {
  color: var(--text-primary) !important;
}

/* Border overrides — green tinted */
.border-gray-700 {
  border-color: var(--border-light) !important;
}

.border-gray-600 {
  border-color: var(--border-medium) !important;
}

.border-gray-500 {
  border-color: var(--border-strong) !important;
}

/* Hover states — green based */
.hover\\:bg-gray-700:hover {
  background-color: rgba(13, 77, 59, 0.08) !important;
}

.hover\\:bg-gray-600:hover {
  background-color: var(--bg-accent) !important;
}

.hover\\:text-white:hover {
  color: var(--text-primary) !important;
}

/* Green background overrides (replacing all blue/orange) */
.bg-orange-600 {
  background-color: rgba(13, 77, 59, 0.88) !important;
  color: #ffffff !important;
}

.hover\\:bg-orange-700:hover {
  background-color: #062F27 !important;
}

/* ========================================
   LAYOUT IMPROVEMENTS
   ======================================== */

.w-full {
  width: 100% !important;
}

.container {
  max-width: none !important;
  width: 100% !important;
}

#dashboard-stats {
  padding: 1.5rem !important;
}

.grid {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

@media (min-width: 768px) {
  #dashboard-stats {
    padding: 2rem !important;
  }
}

@media (min-width: 1200px) {
  #dashboard-stats {
    padding: 2.5rem !important;
  }
}

/* ========================================
   COMPONENT SPECIFIC STYLES
   ======================================== */

/* === SIDEBAR === */
.sidebar {
  background-color: var(--bg-secondary) !important;
  border-right: 1px solid var(--border-light) !important;
}

.nav-item {
  color: var(--text-secondary) !important;
  font-family: var(--font-primary) !important;
  font-weight: 500 !important;
}

/* Active nav — brand green gradient */
.nav-item.active,
.nav-item.nav-item-active {
  background: linear-gradient(135deg,
      rgba(13, 77, 59, 0.92) 0%,
      rgba(6, 47, 39, 0.96) 100%) !important;
  color: #ffffff !important;
}

.nav-item.active .sidebar-text,
.nav-item.nav-item-active .sidebar-text {
  color: #ffffff !important;
  font-weight: 600 !important;
}

.nav-item.active i,
.nav-item.nav-item-active i {
  color: #ffffff !important;
}

.nav-item:hover:not(.active):not(.nav-item-active) {
  background-color: rgba(13, 77, 59, 0.06) !important;
}

/* === HEADERS === */
.header,
.panel-header {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-light) !important;
  font-family: var(--font-primary) !important;
  font-weight: 600 !important;
}

/* === CARDS — Glassmorphism === */
.card,
.bg-gray-800 {
  background: var(--glass-bg-enhanced) !important;
  backdrop-filter: var(--glass-blur) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  box-shadow: var(--shadow-sm) !important;
}

/* === BUTTONS === */
.btn-primary,
.button-primary {
  background: linear-gradient(135deg,
      rgba(13, 77, 59, 0.92) 0%,
      rgba(6, 47, 39, 0.96) 100%) !important;
  color: var(--text-inverse) !important;
  border: none !important;
  font-family: var(--font-primary) !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
  position: relative !important;
  overflow: hidden !important;
}

.btn-primary:hover,
.button-primary:hover {
  background: linear-gradient(135deg,
      rgba(6, 47, 39, 0.96) 0%,
      rgba(13, 77, 59, 0.92) 100%) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 16px 36px -12px rgba(6, 47, 39, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.4) !important;
}

.btn-secondary,
.button-secondary {
  background-color: var(--bg-primary) !important;
  color: var(--text-secondary) !important;
  border: 1px solid rgba(13, 77, 59, 0.25) !important;
  font-family: var(--font-primary) !important;
  font-weight: 500 !important;
}

.btn-secondary:hover,
.button-secondary:hover {
  background-color: rgba(13, 77, 59, 0.06) !important;
  border-color: rgba(13, 77, 59, 0.4) !important;
}

/* === FORMS === */
input,
textarea,
select {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-medium) !important;
  font-family: var(--font-secondary) !important;
  border-radius: var(--radius-md) !important;
}

input:focus,
textarea:focus,
select:focus {
  outline: none !important;
  border-color: var(--brand-green) !important;
  box-shadow: 0 0 0 3px rgba(13, 77, 59, 0.1) !important;
}

/* === UPLOAD ZONES === */
.upload-zone,
#dropZone,
#upload-zone,
#manual-processing-dropzone,
[id*="dropzone"] {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-medium) !important;
  color: var(--text-secondary) !important;
  transition: all 0.2s ease !important;
}

.upload-zone:hover,
#dropZone:hover,
#upload-zone:hover,
#manual-processing-dropzone:hover,
[id*="dropzone"]:hover {
  background-color: rgba(13, 77, 59, 0.04) !important;
  border-color: var(--brand-green) !important;
}

.upload-zone i,
#dropZone i,
#upload-zone i,
#manual-processing-dropzone i,
[id*="dropzone"] i {
  color: var(--text-tertiary) !important;
}

/* === TABLES === */
table {
  background-color: var(--bg-primary) !important;
  border: 1px solid var(--border-light) !important;
}

th {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-primary) !important;
  font-weight: 600 !important;
  border-bottom: 1px solid var(--border-medium) !important;
}

td {
  color: var(--text-secondary) !important;
  font-family: var(--font-secondary) !important;
  border-bottom: 1px solid var(--border-light) !important;
}

tr:hover {
  background-color: rgba(13, 77, 59, 0.03) !important;
}

/* === ACCOUNTING SPECIFIC === */
.debit-amount {
  color: var(--debit-color) !important;
  font-family: var(--font-mono) !important;
  font-weight: 600 !important;
}

.credit-amount {
  color: var(--credit-color) !important;
  font-family: var(--font-mono) !important;
  font-weight: 600 !important;
}

.balance-amount {
  color: var(--balance-color) !important;
  font-family: var(--font-mono) !important;
  font-weight: 700 !important;
}

.konto-code {
  color: var(--konto-color) !important;
  font-family: var(--font-mono) !important;
  font-weight: 500 !important;
}

/* === JOURNAL ENTRIES === */
.journal-entry {
  background: var(--glass-bg-enhanced) !important;
  backdrop-filter: var(--glass-blur) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  border-radius: var(--radius-lg) !important;
  padding: var(--space-lg) !important;
  margin-bottom: var(--space-md) !important;
  transition: all 0.2s ease !important;
}

.journal-entry:hover {
  border-color: rgba(13, 77, 59, 0.25) !important;
  box-shadow: var(--shadow-md) !important;
}

.journal-entry-header {
  color: var(--text-primary) !important;
  font-family: var(--font-primary) !important;
  font-weight: 600 !important;
  margin-bottom: var(--space-sm) !important;
}

.journal-entry-field {
  color: var(--text-secondary) !important;
  font-family: var(--font-secondary) !important;
  margin-bottom: var(--space-xs) !important;
}

/* === MODALS === */
.modal {
  background: var(--glass-bg-enhanced) !important;
  backdrop-filter: var(--glass-blur-enhanced) !important;
  -webkit-backdrop-filter: var(--glass-blur-enhanced) !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  box-shadow: var(--shadow-xl) !important;
  border-radius: var(--radius-xl) !important;
}

.modal-header {
  background-color: rgba(13, 77, 59, 0.04) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-light) !important;
  font-family: var(--font-primary) !important;
  font-weight: 600 !important;
}

/* === LOADING STATES === */
.loading-spinner {
  border-color: var(--border-light) !important;
  border-top-color: var(--brand-green) !important;
}

/* === STATUS INDICATORS (green variants only) === */
.status-pending {
  background-color: rgba(13, 77, 59, 0.06) !important;
  color: #0D4D3B !important;
  border: 1px solid rgba(13, 77, 59, 0.15) !important;
}

.status-approved {
  background-color: rgba(13, 77, 59, 0.1) !important;
  color: #062F27 !important;
  border: 1px solid rgba(13, 77, 59, 0.25) !important;
}

.status-rejected {
  background-color: rgba(6, 47, 39, 0.06) !important;
  color: rgba(6, 47, 39, 0.7) !important;
  border: 1px solid rgba(6, 47, 39, 0.2) !important;
}

/* === DOCUMENT ACTIONS SECTION === */
.document-actions-section {
  background: var(--glass-bg-enhanced) !important;
  backdrop-filter: var(--glass-blur) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  color: var(--text-primary) !important;
}

.current-doc-info {
  background: var(--glass-bg-enhanced) !important;
  backdrop-filter: var(--glass-blur) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  color: var(--text-primary) !important;
}

/* ========================================
   ACCESSIBILITY & PRINT STYLES
   ======================================== */

*:focus {
  outline: 2px solid var(--brand-green) !important;
  outline-offset: 2px !important;
}

@media print {
  * {
    background-color: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  .no-print {
    display: none !important;
  }
}

/* ========================================
   RESPONSIVE OVERRIDES
   ======================================== */

@media (max-width: 768px) {
  :root {
    --space-lg: 1rem;
    --space-xl: 1.5rem;
  }

  .journal-entry {
    padding: var(--space-md) !important;
  }
}

/* ========================================
   DEPARTMENTS MODAL LIGHT THEME
   ======================================== */

.settings-tab {
  color: var(--text-tertiary) !important;
  font-weight: 600 !important;
  border-bottom: 2px solid transparent !important;
  transition: all 0.2s ease !important;
}

.settings-tab:hover {
  color: var(--text-secondary) !important;
}

.settings-tab.active-tab {
  color: #0D4D3B !important;
  border-bottom-color: #0D4D3B !important;
}

#settings-modal .flex.flex-col {
  background-color: var(--bg-primary) !important;
}

.form-section {
  margin-bottom: 1.5rem !important;
  padding-bottom: 1.5rem !important;
  border-bottom: 1px solid var(--border-light) !important;
}

.form-section:last-of-type {
  border-bottom: none !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.form-section h4 {
  color: var(--text-primary) !important;
  font-weight: 600 !important;
  margin-bottom: 1rem !important;
}

/* Toggle switch — brand green */
.toggle-slider {
  background-color: rgba(6, 47, 39, 0.3) !important;
  /* Muted green when OFF */
  transition: 0.4s !important;
  border-radius: 24px !important;
}

.toggle-slider:before {
  background-color: white !important;
  transition: 0.4s !important;
  border-radius: 50% !important;
}

input:checked+.toggle-slider {
  background-color: #0D4D3B !important;
  /* Brand green when ON */
}

input:checked+.toggle-slider:before {
  transform: translateX(20px) !important;
}

/* Form inputs */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
  background-color: var(--bg-primary) !important;
  border: 1px solid var(--border-medium) !important;
  color: var(--text-primary) !important;
  border-radius: 0.5rem !important;
  padding: 0.75rem !important;
  transition: border-color 0.2s ease !important;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none !important;
  border-color: var(--brand-green) !important;
  box-shadow: 0 0 0 3px rgba(13, 77, 59, 0.1) !important;
}

.form-group label {
  color: var(--text-secondary) !important;
  font-weight: 500 !important;
  margin-bottom: 0.5rem !important;
}

/* ========================================
   BUTTON OVERRIDES FOR BRAND THEME
   ======================================== */

/* New Client button — subtle outline */
html.light #create-new-client-btn,
.light #create-new-client-btn,
html.light #create-new-client-btn *,
.light #create-new-client-btn * {
  color: #0D4D3B !important;
  border-color: rgba(13, 77, 59, 0.25) !important;
}

html.light #create-new-client-btn:hover,
.light #create-new-client-btn:hover {
  background-color: rgba(13, 77, 59, 0.1) !important;
}

/* Upload Documents button — solid brand green */
html.light #upload-documents-btn,
.light #upload-documents-btn {
  background: linear-gradient(135deg,
      rgba(13, 77, 59, 0.92) 0%,
      rgba(6, 47, 39, 0.96) 100%) !important;
}

html.light #upload-documents-btn,
.light #upload-documents-btn,
html.light #upload-documents-btn *,
.light #upload-documents-btn * {
  color: #ffffff !important;
}

html.light #upload-documents-btn:hover,
.light #upload-documents-btn:hover {
  box-shadow: 0 16px 36px -12px rgba(6, 47, 39, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.4) !important;
}

/* Journal Manager link — brand green */
html.light #journal-manager-btn,
.light #journal-manager-btn {
  background: linear-gradient(135deg,
      rgba(13, 77, 59, 0.92) 0%,
      rgba(6, 47, 39, 0.96) 100%) !important;
}

html.light #journal-manager-btn,
.light #journal-manager-btn,
html.light #journal-manager-btn *,
.light #journal-manager-btn * {
  color: #ffffff !important;
}

html.light #journal-manager-btn:hover,
.light #journal-manager-btn:hover {
  box-shadow: 0 16px 36px -12px rgba(6, 47, 39, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.4) !important;
}

/* ========================================
   DARK MODE COMPATIBILITY
   ======================================== */

@media (prefers-color-scheme: dark) {

  /* Brand buttons maintain their colors */
  html.light a[href="/journal-manager"],
  .light a[href="/journal-manager"] {
    background: linear-gradient(135deg,
        rgba(13, 77, 59, 0.92) 0%,
        rgba(6, 47, 39, 0.96) 100%) !important;
  }

  html.light a[href="/journal-manager"],
  .light a[href="/journal-manager"],
  html.light a[href="/journal-manager"] *,
  .light a[href="/journal-manager"] * {
    color: #ffffff !important;
  }

  html.light #create-new-client-btn,
  .light #create-new-client-btn,
  html.light #create-new-client-btn *,
  .light #create-new-client-btn * {
    background-color: rgba(13, 77, 59, 0.06) !important;
    color: #0D4D3B !important;
    border-color: rgba(13, 77, 59, 0.25) !important;
  }

  html.light #upload-documents-btn,
  .light #upload-documents-btn {
    background: linear-gradient(135deg,
        rgba(13, 77, 59, 0.92) 0%,
        rgba(6, 47, 39, 0.96) 100%) !important;
  }

  html.light #upload-documents-btn,
  .light #upload-documents-btn,
  html.light #upload-documents-btn *,
  .light #upload-documents-btn * {
    color: #ffffff !important;
  }
}

/* ========================================
   FINQUP SCROLLBAR
   ======================================== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg,
      rgba(79, 172, 171, 0.4) 0%,
      rgba(13, 77, 59, 0.5) 50%,
      rgba(79, 172, 171, 0.4) 100%);
  border-radius: 10px;
  border: 1px solid rgba(79, 172, 171, 0.3);
  box-shadow:
    0 0 8px rgba(79, 172, 171, 0.4),
    inset 0 1px 1px rgba(255, 255, 255, 0.5),
    inset 0 -1px 1px rgba(13, 77, 59, 0.3);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg,
      rgba(79, 172, 171, 0.6) 0%,
      rgba(13, 77, 59, 0.7) 50%,
      rgba(79, 172, 171, 0.6) 100%);
  border: 1px solid rgba(79, 172, 171, 0.5);
  box-shadow:
    0 0 12px rgba(79, 172, 171, 0.6),
    inset 0 1px 1px rgba(255, 255, 255, 0.6),
    inset 0 -1px 1px rgba(13, 77, 59, 0.4);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(13, 77, 59, 0.5) transparent;
}