/* Main Container */
.cfm-container {
    display: flex;
    min-height: 600px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

/* Sidebar */
.cfm-sidebar {
    width: 200px;
    background: #f4f4f4;
    border-right: 1px solid #e0e0e0;
    padding: 20px 0;
}

/* Portfolio Selector */
/* ——————————————————————————
   Sidebar Portfolio Selector
   spans full width & custom arrow
   —————————————————————————— */
.cfm-portfolio-selector {
    /* remove left/right offset so it fills .cfm-sidebar */
    margin: 0 0 20px;
    /* keep a bit of breathing space underneath */
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.cfm-portfolio-selector select {
    /* now true-full‐width within the sidebar */
    width: 100%;
    /* match the padding & feel of your filters */
    padding: 10px 16px;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    /* remove the browser’s native arrow */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* add a custom down-chevron */
    background-image: url("data:image/svg+xml;charset=UTF-8,\
%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E\
%3Cpath fill='%23666' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cfm-portfolio-selector select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}


.cfm-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cfm-sidebar li {
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cfm-sidebar li:hover,
.cfm-sidebar li.active {
    background-color: #e0e0e0;
}

.cfm-sidebar a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

/* Main Content */
.cfm-main {
    flex: 1;
    padding: 20px;
}

.cfm-main {
  width: 100%;
  overflow-x: auto;
}

/* 2) Force the table inside .cfm-main to fill its container & use fixed layout */
.cfm-main #cfm-accounts-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

/* 3) Give the first column 30%, split the remaining 70% across the other 6 columns */
.cfm-main #cfm-accounts-table th:first-child,
.cfm-main #cfm-accounts-table td:first-child {
  width: 30%;
}

.cfm-main #cfm-accounts-table th:not(:first-child),
.cfm-main #cfm-accounts-table td:not(:first-child) {
  width: calc(70% / 6);
}

/* 4) Prevent wrapping and enable ellipsis */
.cfm-main #cfm-accounts-table th,
.cfm-main #cfm-accounts-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  padding: 8px; /* adjust as needed */
  font-family: inherit;
}

/* 5) Tweak font-size & padding on narrow screens */
@media (max-width: 600px) {
  .cfm-main #cfm-accounts-table th,
  .cfm-main #cfm-accounts-table td {
    font-size: 0.875rem;
    padding: 6px;
  }
}

/* Filters */
.cfm-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cfm-search input {
    width: 300px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.cfm-filter-group {
    display: flex;
    gap: 10px;
}

.cfm-filter-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

/* Table Styles */
.cfm-table-container {
    overflow-x: auto;
}

.cfm-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.cfm-table th,
.cfm-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.cfm-table th {
    background-color: #f8f8f8;
    font-weight: 600;
}

.cfm-table tr:hover {
    background-color: #f5f5f5;
}

.cfm-table .balance {
    text-align: right;
    font-family: monospace;
}

/* Debt table column widths */
#cfm-debt-table th:nth-child(1),
#cfm-debt-table td:nth-child(1) { width: 200px; } /* Title */
#cfm-debt-table th:nth-child(2),
#cfm-debt-table td:nth-child(2) { width: 150px; } /* Type */
#cfm-debt-table th:nth-child(3),
#cfm-debt-table td:nth-child(3) { width: 150px; } /* Subtype */
#cfm-debt-table th:nth-child(4),
#cfm-debt-table td:nth-child(4) { width: 100px; } /* Currency */
#cfm-debt-table th:nth-child(5),
#cfm-debt-table td:nth-child(5) { width: 150px; } /* Balance */
#cfm-debt-table th:nth-child(6),
#cfm-debt-table td:nth-child(6) { width: 150px; } /* Actions */

/* Left-align all headers and cells in the debt table */
#cfm-debt-table th,
#cfm-debt-table td {
  text-align: left;
  font-family: inherit;
}


/* Buttons */
.cfm-button {
    padding: 8px 16px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cfm-button:hover {
    background-color: #0056b3;
}

.cfm-button-icon {
    padding: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.cfm-button-icon:hover {
    color: #333;
}

/* Modal */
.cfm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.cfm-modal.show {
    display: block;
}

.cfm-modal-content {
    position: relative;
    width: 95%;
    max-width: 1200px;
    margin: 30px auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Table responsiveness */
.cfm-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    position: relative;
}

.cfm-table-container::-webkit-scrollbar {
    height: 8px;
}

.cfm-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.cfm-table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.cfm-table-container::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Adjust table column widths */
.cfm-transactions-table th,
.cfm-transactions-table td {
    white-space: nowrap;
    padding: 12px 16px;
}

.cfm-transactions-table th:first-child,
.cfm-transactions-table td:first-child {
    padding-left: 20px;
    position: sticky;
    left: 0;
    background: inherit;
}

.cfm-transactions-table td.amount,
.cfm-transactions-table td.balance {
    text-align: right;
    font-family: monospace;
    font-size: 1.1em;
}

.cfm-transactions-table td.notes {
    white-space: normal;
    min-width: 200px;
    max-width: 400px;
}

.cfm-transactions-table td.actions {
    white-space: nowrap;
    text-align: right;
    padding-right: 20px;
}

.cfm-modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.cfm-modal-header h2 {
    margin: 0;
    margin-right: 10px;
}

.cfm-modal-header .account-type {
    color: #666;
    font-size: 0.9em;
}

.cfm-modal-actions {
    margin-left: auto;
}

/* Tabs */
.cfm-modal-tabs {
    display: flex;
    margin-bottom: 20px;
}

.cfm-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.cfm-tab.active {
    border-bottom-color: #007bff;
    color: #007bff;
}

.cfm-tab-content {
    display: none;
}

.cfm-tab-content.active {
    display: block;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

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

.radio-group {
    display: flex;
    gap: 15px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.date-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.calendar-icon {
    position: absolute;
    right: 10px;
    color: #666;
    pointer-events: none;
}

/* Empty State */
.cfm-empty-state {
    text-align: center;
    padding: 40px 20px;
}

.cfm-empty-state img {
    max-width: 200px;
    margin-bottom: 20px;
}

.cfm-empty-state h2 {
    margin: 0 0 10px;
    color: #333;
}

.cfm-empty-state p {
    color: #666;
    margin-bottom: 20px;
}

/* Transactions Table */
.cfm-transactions-toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.cfm-transactions-table th:first-child,
.cfm-transactions-table td:first-child {
    width: 40px;
    text-align: center;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Value History Table */
.cfm-values-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    table-layout: fixed;
}

.cfm-values-table th,
.cfm-values-table td {
    white-space: nowrap;
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cfm-values-table th {
    background-color: #f8f8f8;
    font-weight: 600;
}

.cfm-values-table tr:hover {
    background-color: #f5f5f5;
}

/* Column widths */
.cfm-values-table th:nth-child(1), /* Date */
.cfm-values-table td:nth-child(1) {
    width: 120px;
}

.cfm-values-table th:nth-child(2), /* Price */
.cfm-values-table td:nth-child(2),
.cfm-values-table th:nth-child(3), /* Price (FX) */
.cfm-values-table td:nth-child(3),
.cfm-values-table th:nth-child(4), /* Value */
.cfm-values-table td:nth-child(4) {
    width: 120px;
}

.cfm-values-table th:nth-child(5), /* Return % */
.cfm-values-table td:nth-child(5),
.cfm-values-table th:nth-child(6), /* Return % (FX) */
.cfm-values-table td:nth-child(6) {
    width: 120px;
}

.cfm-values-table td[data-numeric="true"] {
    text-align: right;
    font-family: monospace;
    font-size: 1.1em;
    padding-right: 12px;
}

.cfm-values-table td:last-child {
    width: 80px;
    text-align: right;
    padding-right: 16px;
}

.cfm-values-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.cfm-values-table .cfm-button-icon {
    margin-left: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cfm-container {
        flex-direction: column;
    }
    
    .cfm-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .cfm-filters {
        flex-direction: column;
        gap: 10px;
    }
    
    .cfm-search input {
        width: 100%;
    }
    
    .cfm-filter-group {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .cfm-filter-group select {
        flex: 1;
    }
    
    .cfm-modal-content {
        width: 95%;
        margin: 20px auto;
    }
}

/* Auto-update Animation */
.cfm-table td.updating {
    animation: highlight 1s ease-out;
}

@keyframes highlight {
    0% {
        background-color: #fff3cd;
    }
    100% {
        background-color: transparent;
    }
}

/* Fix Position Details column widths */
.cfm-position-details-table {
  width: 100% !important;
  table-layout: fixed;        /* enforce fixed layout */
}

.cfm-position-details-table th,
.cfm-position-details-table td {
  padding: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Optional: give each column an equal 10% width */
.cfm-position-details-table th:nth-child(1),
.cfm-position-details-table td:nth-child(1),
.cfm-position-details-table th:nth-child(2),
.cfm-position-details-table td:nth-child(2),
/* …repeat for all 10 columns… */
.cfm-position-details-table th:nth-child(10),
.cfm-position-details-table td:nth-child(10) {
  width: 10%;
}

.cfm-table th, .cfm-table td {
  text-align: left;
  padding: 8px;
  word-break: break-word;
}

.cfm-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

/* ──────────────────────────────────────────────────────────────────────────── */
/* Override ALL buttons to black background + white text                      */
/* ──────────────────────────────────────────────────────────────────────────── */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
a.button,
.cfm-button {
  background-color: #302f2f !important;  /* ← NEW: black bg */
  color:            #fff !important;  /* ← NEW: white text */
  border:           1px solid #302f2f !important;
}

button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
a.button:hover,
.cfm-button:hover {
  background-color: #494848 !important;  /* ← NEW: slightly lighter on hover */
}

/* ──────────────────────────────────────────────────────────────────────────── */
/* Force a light grey hover on all plugin buttons                             */
/* ──────────────────────────────────────────────────────────────────────────── */
html body button:hover,
html body input[type="button"]:hover,
html body input[type="submit"]:hover,
html body input[type="reset"]:hover,
html body a.button:hover,
html body .cfm-button:hover {
  background-color: #d3d3d3 !important;  /* light grey */
  border-color:     #d3d3d3 !important;
  color:            #000      !important;  /* optionally turn text black */
}


/* ──────────────────────────────────────────────────────────────────────────── */
/* Force black bg + white text and light grey hover on Assets-Table actions  */
/* ──────────────────────────────────────────────────────────────────────────── */
html body #cfm-accounts-table .cfm-button-icon,
html body #cfm-accounts-table .cfm-details-btn,
html body #cfm-accounts-table .cfm-button {
  background-color: #000 !important;    /* ← UPDATED */
  color:            #fff !important;    /* ← UPDATED */
  border:           1px solid #000 !important;  /* ← UPDATED */
}

html body #cfm-accounts-table .cfm-button-icon:hover,
html body #cfm-accounts-table .cfm-details-btn:hover,
html body #cfm-accounts-table .cfm-button:hover {
  background-color: #d3d3d3 !important; /* ← UPDATED */
  border-color:     #d3d3d3 !important; /* ← UPDATED */
  color:            #000 !important;    /* ← UPDATED */
}

.cfm-pagination {
  text-align: center;
  margin-top: 10px;
}
.cfm-pagination button {
  margin: 0 5px;
  padding: 5px 8px;
}
.cfm-pagination span {
  margin: 0 10px;
}

/* Inline-move the delete button beside the Asset Type */
#cfm-account-details .cfm-modal-header .inline-delete {
  margin-left: 3em;
  vertical-align: middle;
}

.cfm-modal-tabs {
  margin-bottom: 1.5rem;  /* ↑ adjust to taste */
}

.cfm-modal-tabs .cfm-tab {
  margin-right: 0.25rem;  /* ↑ adjust to taste */
}

.cfm-modal-tabs .cfm-tab:last-child {
  margin-right: 0;
}

/* ── Toast styles ───────────────────────────────────────────────────────── */
.cfm-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px 15px;
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 2000;
}
.cfm-toast.visible {
  opacity: 1;
  transform: translateY(0);
}
.cfm-toast--success {
  background-color: rgba(40, 167, 69, 0.9);
}
.cfm-toast--error {
  background-color: rgba(220, 53, 69, 0.9);
}
