/* File: src/static/css/custom.css */
/* for tree in chart_of_acounts.html */

.tree-node {
  padding-left: var(--indent, 0rem);
}

.line-item-row {
  display: flex;
  align-items: left;
  padding: 0.5rem 1rem !important;

}


.btn {
  border-radius: 4px !important; /* match sidebar */
  font-weight: 500 !important;
  letter-spacing: 0.5px !important;
  text-transform: none !important; /* match sidebar style */
  transition: background 0.2s, color 0.2s, box-shadow 0.2s !important;
  box-shadow: none !important;
}

/* Hover / focus */
.btn:hover {
  opacity: 0.95 !important;
}

.btn:focus,
.btn:active {
  outline: none !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* === PRIMARY === */
.btn-primary {
  background: var(--posh-primary, #1976d2);
  color: var(--posh-white, #fff);
  border: none;
}

.btn-primary:hover {
  background: var(--posh-primary, #1976d2);
  opacity: 0.9;
}

/* === OUTLINE SECONDARY === */
.btn-outline-secondary {
  background: transparent;
  color: var(--posh-body-color, #555);
  border: 2px solid var(--posh-body-color, #555);
}

.btn-outline-secondary:hover {
  background: var(--posh-primary-bg-subtle, #f5f5f5);
  color: var(--posh-primary, #1976d2);
  border-color: var(--posh-primary, #1976d2);
}

/* === SUCCESS === */
.btn-success {
  background: var(--posh-success, #4caf50);
  color: var(--posh-white, #fff);
  border: none;
}

.btn-success:hover {
  background: #43a047;
}

/* === OUTLINE SUCCESS === */
.btn-outline-success {
  background: transparent;
  color: var(--posh-success, #4caf50);
  border: 2px solid var(--posh-success, #4caf50);
}

.btn-outline-success:hover {
  background: rgba(76, 175, 80, 0.1);
}

/* === DANGER === */
.btn-danger {
  background: var(--posh-danger, #f44336);
  color: var(--posh-white, #fff);
  border: none;
}

.btn-danger:hover {
  background: #e53935;
}

/* === OUTLINE DANGER === */
.btn-outline-danger {
  background: transparent;
  color: var(--posh-danger, #f44336);
  border: 2px solid var(--posh-danger, #f44336);
}

.btn-outline-danger:hover {
  background: rgba(244, 67, 54, 0.1);
}

/* === WARNING === */
.btn-warning {
  background: var(--posh-warning, #ff9800);
  color: var(--posh-white, #fff);
  border: none;
}

.btn-warning:hover {
  background: #fb8c00;
}

/* === OUTLINE WARNING === */
.btn-outline-warning {
  background: transparent;
  color: var(--posh-warning, #ff9800);
  border: 2px solid var(--posh-warning, #ff9800);
}

.btn-outline-warning:hover {
  background: rgba(255, 152, 0, 0.1);
}

/* === INFO === */
.btn-info {
  background: var(--posh-info, #2196f3);
  color: var(--posh-white, #fff);
  border: none;
}

.btn-info:hover {
  background: #1e88e5;
}

/* === OUTLINE INFO === */
.btn-outline-info {
  background: transparent;
  color: var(--posh-info, #2196f3);
  border: 2px solid var(--posh-info, #2196f3);
}

.btn-outline-info:hover {
  background: rgba(33, 150, 243, 0.1);
}

/* === LIGHT === */
.btn-light {
  background: #f8f9fa;
  color: #333;
  border: 1px solid #ddd;
}

.btn-light:hover {
  background: #e2e6ea;
}

/* === DARK === */
.btn-dark {
  background: #333;
  color: #fff;
  border: none;
}

.btn-dark:hover {
  background: #222;
}

/* write_check CSS */

.check-container {
    background: #f9f9f9 !important;
    border-radius: 8px;
    /* box-shadow: 0 2px 4px rgba(0,0,0,0.1); */
}

.amount-words-container {
  border: none !important;
  outline: none !important;
  background: transparent;
  padding: 0;
  margin: 0;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.5;
  box-shadow: none !important;
}

#amountInWords {
  border: none !important;
  display: inline-block;
}

.amount-words-text {
    font-family: 'Courier New', monospace;
    color: #000;
}

.signature-line {
    border-bottom: 1px solid #000 !important;
    height: 40px;
    margin-top: 20px;
}

#bankBalance {
    font-size: 1em;
    color: #198754;
    /* text-shadow: 0 1px 2px rgba(0,0,0,0.1); */
    align-items: middle;
}

.line-item-row.deleted {
    opacity: 0.5;
    text-decoration: line-through;
}

.text-danger {
    color: #dc3545 !important;
}

.bg-light {
    background-color: #f8f9fa !important;
}

.table-responsive {
    border-radius: 0.375rem;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.btn-outline-primary:hover {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-outline-danger:hover {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

/* Currency input styling */
input[type="number"] {
    text-align: right;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .check-container {
        padding: 1rem !important;
    }
    
    .amount-words-text {
        font-size: 0.9em;
    }
    
    .table-responsive {
        font-size: 0.9em;
    }
}

/* Print styles */
@media print {
    .btn, .card-header button {
        display: none !important;
    }
    
    .check-container {
        border: 2px solid #000 !important;
        background: white !important;
    }
}

/* 
   FORM STYLING - Radio Buttons and Labels (OPTIMIZED)
 */

/* Main form labels (field labels) - Smaller font size */
.form-group label,
.form-label {
    text-transform: none !important;
    letter-spacing: normal !important;      /* in case the theme added tracking */
    font-variant-caps: normal !important;    /* in case small-caps were used */  
    font-size: 0.875rem !important; /* Smaller: 14px instead of 16px */
    font-weight: 600 !important;
    margin-bottom: 0.5rem;
}

/* Radio button container styling */
.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem; /* Small spacing between radio options */
}

/* Radio button input styling */
.form-check-input {
    margin-top: 0 !important; /* Remove default margin for perfect alignment */
    margin-right: 0.5rem !important; /* Space between radio and label */
    margin-bottom: 0 !important;
    margin-left: 0 !important; /* Override any conflicting left margin */
    flex-shrink: 0; /* Prevent radio button from shrinking */
}

/* Radio button labels - Make them normal weight and smaller */
.form-check-label {
    font-size: 0.875rem !important; /* Smaller: 14px */
    font-weight: 400 !important; /* Normal weight for radio options */
    margin-bottom: 0 !important;
    margin-left: 0 !important; /* Remove conflicting margin */
    line-height: 1.5; /* Ensure good line height for alignment */
}

/* Override crispy forms specific styling */
.crispy-forms .form-check-label {
    font-size: 0.875rem !important; /* Smaller: 14px */
    font-weight: 400 !important; /* Normal weight for radio options */
    margin-left: 0 !important;
}

/* Remove the conflicting selector that makes radio labels bold */
input[type="radio"] + label,
.form-check input[type="radio"] + .form-check-label {
    font-size: 0.875rem !important; /* Smaller: 14px */
    font-weight: 400 !important; /* Normal weight for radio options */
}

/* Radio button groups container */
.d-flex.gap-3 {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

/* Section headers (like "Physical Address") */
h5.fw-semibold {
    font-size: 1.1rem;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.25rem;
    margin-bottom: 1rem;
}

/* Required field asterisks - Make them red and add space */
.text-danger {
    color: #dc3545 !important;
    font-weight: 600 !important;
    margin-left: 0.25rem; /* Add space before asterisk */
}

/* Specifically target asterisks in labels */
.form-label .text-danger,
label .text-danger {
    color: #dc3545 !important;
    font-weight: 600 !important;
    margin-left: 0rem !important; /* Space before asterisk */
}

/* Button spacing */
.btn + .btn {
    margin-left: 0.5rem;
}
.tree-toggle {
  transition: transform 0.2s ease;
  user-select: none;
}

.tree-toggle.collapsed {
  transform: rotate(-90deg);
}

.account-row.collapsed {
  display: none;
}

.inactive-account {
  opacity: 0.6;
}

/* Account indentation classes - CRITICAL FOR TREE STRUCTURE */
.account-indent-0 { padding-left: 0px; }
.account-indent-1 { padding-left: 25px; }
.account-indent-2 { padding-left: 50px; }
.account-indent-3 { padding-left: 75px; }
.account-indent-4 { padding-left: 100px; }
.account-indent-5 { padding-left: 125px; }
.account-indent-6 { padding-left: 150px; }
.account-indent-7 { padding-left: 175px; }
.account-indent-8 { padding-left: 200px; }
.account-indent-9 { padding-left: 225px; }

/* .card {
  transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
} */

.table tbody tr:hover {
  background-color: #f9fafb;
}

.btn-group .btn {
  border-radius: 0.375rem;
  margin-right: 2px;
}

.btn-group .btn:last-child {
  margin-right: 0;
}

.input-group-text {
  background-color: #f8f9fa;
  border-color: #dee2e6;
}

/* Custom font size scale (fs-1 → fs-9) */
/* fs-9 is the default/most-used small size (0.875rem) */

.fs-1 { font-size: 3rem !important; }     /* 48px */
.fs-2 { font-size: 2.5rem !important; }   /* 40px */
.fs-3 { font-size: 2rem !important; }     /* 32px */
.fs-4 { font-size: 1.75rem !important; }  /* 28px */
.fs-5 { font-size: 1.5rem !important; }   /* 24px */
.fs-6 { font-size: 1.25rem !important; }  /* 20px */
.fs-7 { font-size: 1.125rem !important; } /* 18px */
.fs-8 { font-size: 1rem !important; }     /* 16px */
.fs-9 { font-size: 0.875rem !important; font-weight: 500;} /* 14px */


/* Improve button styling */
.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-warning:hover,
.btn-outline-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .table-responsive {
    font-size: 0.8rem;
  }
  
  .btn-group .btn {
    padding: 0.25rem 0.5rem;
  }
  
  .card-body.text-center h5 {
    font-size: 1rem;
  }
  
  /* Reduce indentation on mobile */
  .account-indent-1 { padding-left: 15px; }
  .account-indent-2 { padding-left: 30px; }
  .account-indent-3 { padding-left: 45px; }
  .account-indent-4 { padding-left: 60px; }
  .account-indent-5 { padding-left: 75px; }
  .account-indent-6 { padding-left: 90px; }
  .account-indent-7 { padding-left: 105px; }
  .account-indent-8 { padding-left: 120px; }
  .account-indent-9 { padding-left: 135px; }
}

/* Add these styles to your existing custom.css file */

/* Tree toggle enhancements */
.tree-toggle {
  transition: transform 0.2s ease, color 0.2s ease;
  user-select: none;
  cursor: pointer !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 3px;
}

.tree-toggle:hover {
  background-color: rgba(13, 110, 253, 0.1);
  color: #0d6efd !important;
}

.tree-toggle.collapsed {
  transform: rotate(-90deg);
}

.tree-toggle i {
  font-size: 12px;
  transition: color 0.2s ease;
}

/* Account row hover effects */
.account-row {
  transition: background-color 0.2s ease;
}

.account-row:hover {
  background-color: rgba(0, 0, 0, 0.02) !important;
}

/* Ensure tree structure visibility */
.account-row[data-parent-id] {
  border-left: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.account-row[data-parent-id]:hover {
  border-left-color: rgba(13, 110, 253, 0.2);
}

/* Visual hierarchy for different levels */
.account-row[data-level="0"] {
  font-weight: 600;
  background-color: rgba(0, 0, 0, 0.01);
}

.account-row[data-level="1"] {
  background-color: rgba(0, 0, 0, 0.005);
}

/* Improve button group in account rows */
.account-row .btn-group {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.account-row:hover .btn-group {
  opacity: 1;
}

/* Expand/Collapse buttons styling */
#expandAllBtn,
#collapseAllBtn {
  transition: all 0.2s ease;
}

#expandAllBtn:hover,
#collapseAllBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Search input focus state */
#accountSearch:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Account name link styling */
.account-row a {
  transition: color 0.2s ease;
  text-decoration: none !important;
}

.account-row a:hover {
  color: #0d6efd !important;
  text-decoration: underline !important;
}

/* Fix any potential z-index issues */
.tree-toggle {
  position: relative;
  z-index: 1;
}

/* Loading state for dynamic operations */
.chart-loading {
  pointer-events: none;
  opacity: 0.6;
  position: relative;
}

.chart-loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  z-index: 999;
}

/* Smooth transitions for show/hide */
.account-row {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.account-row.hiding {
  opacity: 0;
  transform: translateX(-10px);
}

/* Better visual feedback for inactive accounts */
.inactive-account {
  opacity: 0.6;
  position: relative;
}

.inactive-account::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  right: 0;
  height: 1px;
  background: rgba(108, 117, 125, 0.4);
  z-index: 1;
}

/* Fix for mobile touch targets */
@media (max-width: 768px) {
  .tree-toggle {
    width: 30px;
    height: 30px;
  }
  
  .tree-toggle i {
    font-size: 14px;
  }
  
  /* Always show buttons on mobile */
  .account-row .btn-group {
    opacity: 1;
  }
}

.item-type-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

/* Material Icons CSS */

.material-icons.md-18 { font-size: 18px; }
.material-icons.md-24 { font-size: 24px; }
.material-icons.md-36 { font-size: 36px; }
.material-icons.md-48 { font-size: 48px; }

.material-icons.gray600   { color: #757575; }
.material-icons.blue600   { color: #1E88E5; }
.material-icons.green600  { color: #43A047; }
.material-icons.orange600 { color: #FB8C00; }
.material-icons.yellow600 { color: #FDD835; }
.material-icons.red600    { color: #E53935; }
.material-icons.purple600 { color: #8E24AA; }
.material-icons.teal600   { color: #00897B; }

/* Avatar container sizes */
.avatar { width: 40px; height: 40px; position: relative; display: inline-block; }
.avatar.avatar-xl { width: 48px; height: 48px; }

/* Initials circle */
.avatar-name {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  background: #e9ecef;        /* light gray */
  color: #495057;              /* dark gray text */
  font-weight: 600;
  font-size: 0.875rem;         /* tweak to taste */
}
.rounded-circle { border-radius: 50% !important; }

/* Keep controls from wrapping and ensure consistent compact sizing */
#lineItemsTable td .form-control,
#lineItemsTable td .form-select {
  width: 100%;
  min-width: 0;
}

/* Compact size to match your table density (Bootstrap-ish small controls) */
#lineItemsTable td .form-control,
#lineItemsTable td .form-select {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem; /* ~fs-9 */
  line-height: 1.25;
  height: auto;
}

/* Keep numeric/currency right-aligned and avoid shrink issues */
#lineItemsTable td .text-end.form-control {
  text-align: right;
}

/* Prevent header/row misalignment by removing extra default table cell padding */
#lineItemsTable th, #lineItemsTable td {
  vertical-align: middle;
  white-space: nowrap; /* prevent label wraps that break column geometry */
}
#lineItemsTable td:nth-child(5) { /* Memo column can wrap */
  white-space: normal;
}


/* Override theme's tiny label size and fix alignment */
.form-label,
.form-group label,
.mb-3 label {
    font-size: 0.875rem !important; /* 14px - much better than theme's 0.64rem */
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
    display: block;
    width: 100%;
}

/* Fix Crispy Forms indentation */
.crispy-forms .form-group,
.crispy-forms .mb-3 {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

/* Ensure radio button labels are normal weight and aligned */
.form-check-label {
    font-size: 0.875rem !important;
    font-weight: 400 !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
}

/* Fix any Bootstrap column padding issues */
.tab-content .col,
.tab-content [class*="col-"] {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}