/* ===== Expenses Module Styles ===== */

/* -- Expenses page: fixed layout (no page-level scroll) -- */
#expenses-page.page.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#expenses-page .bulk-toolbar {
    flex-shrink: 0;
}

#expenses-page #expensesSummaryCards {
    flex-shrink: 0;
}

#expenses-page #expensesList {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* -- Expenses toolbar (search + filters + new button in one row) -- */
.exp-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.exp-toolbar-search {
    flex: 1;
    min-width: 0;
    max-width: 320px;
}

.exp-toolbar-select {
    width: auto;
    min-width: 120px;
    max-width: 180px;
}


.exp-toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* -- Expense List: table layout -- */
.exp-list-table {
    table-layout: fixed;
    width: 100%;
}

.exp-list-table .exp-col-ref     { width: 30%; }
.exp-list-table .exp-col-kind    { width: 15%; }
.exp-list-table .exp-col-date    { width: 12%; white-space: nowrap; }
.exp-list-table .exp-col-amount  { width: 20%; white-space: nowrap; text-align: right; }
.exp-list-table .exp-col-actions { width: 11%; white-space: nowrap; text-align: center; }

.exp-list-table thead th {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-secondary, #64748b);
    padding: 0;
}
.exp-list-table thead th:not(:has(.btn-link)) {
    padding: 8px 16px;
}
.exp-list-table thead th .btn-link {
    padding: 10px 16px;
}

/* Amount header button: inherit right-align from column */
.exp-list-table thead th.exp-col-amount .btn-link {
    justify-content: flex-end;
    text-align: right;
    width: 100%;
}

.exp-list-table tbody td {
    padding: 10px 16px;
    font-size: 13px;
    vertical-align: middle;
}

.exp-row { cursor: pointer; }
.exp-row:hover { background: rgba(59, 130, 246, 0.04); }

/* -- Expense List: cell typography -- */
.exp-cell-primary {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
    line-height: 1.4;
}

.exp-cell-secondary {
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.4;
    margin-top: 1px;
}

.exp-cell-danger {
    color: var(--danger-color, #ef4444);
    font-weight: 500;
}

.exp-cell-void {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.4;
}

.exp-cell-overdue {
    font-size: 11px;
    font-weight: 500;
    color: var(--danger-color, #ef4444);
    margin-top: 1px;
}

.exp-category-sub {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    margin-top: 2px;
}

/* -- Expense kind badges -- */
.exp-kind-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid transparent;
    line-height: 1.4;
    white-space: nowrap;
}

.exp-kind-badge--e_invoice,
.exp-kind-badge--supplier_invoice {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.18);
    color: #1d4ed8;
}
.exp-kind-badge--receipt {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(217, 119, 6, 0.18);
    color: #b45309;
}
.exp-kind-badge--cash {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(5, 150, 105, 0.18);
    color: #059669;
}
.exp-kind-badge--tax {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(220, 38, 38, 0.16);
    color: #b91c1c;
}
.exp-kind-badge--mtv {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(220, 38, 38, 0.16);
    color: #b91c1c;
}
.exp-kind-badge--fine {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(220, 38, 38, 0.16);
    color: #b91c1c;
}
.exp-kind-badge--salary {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(8, 145, 178, 0.18);
    color: #0891b2;
}
.exp-kind-badge--other {
    background: rgba(107, 114, 128, 0.1);
    border-color: rgba(75, 85, 99, 0.16);
    color: #4b5563;
}

/* -- Expense dropdown (New Expense button) -- */
.exp-dropdown {
    position: relative;
    display: inline-block;
}

.exp-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.exp-dropdown-caret {
    font-size: 10px;
    margin-left: 2px;
    transition: transform 0.15s ease;
}

.exp-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 100;
    min-width: 180px;
    background: white;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    padding: 4px 0;
}

.exp-dropdown-menu.open {
    display: block;
}

.exp-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: background 0.12s;
}

.exp-dropdown-item:hover {
    background: var(--bg-secondary, #f8fafc);
}

.exp-dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary, #64748b);
}

/* -- Expense summary cards -- */
.summary-cards-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.summary-card {
    flex: 1;
    min-width: 160px;
    background: var(--bg-secondary, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    padding: 12px 16px;
}

.summary-card-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    margin-bottom: 4px;
}

.summary-card-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

.summary-card-sub {
    font-size: 11px;
    color: var(--text-secondary, #94a3b8);
    margin-top: 2px;
}

/* -- Expense modal: input with inline suffix select (KDV oranı) -- */
.input-with-suffix {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    overflow: hidden;
}

.input-with-suffix input {
    flex: 1;
    border: none;
    border-radius: 0;
    min-width: 0;
    box-shadow: none;
}

.input-with-suffix input:focus {
    outline: none;
    box-shadow: none;
}

.input-suffix-select {
    border: none;
    border-left: 1px solid var(--border-color, #e2e8f0);
    border-radius: 0;
    background: transparent;
    padding: 0 22px 0 8px;
    font-size: 0.8em;
    color: var(--text-muted, #a0aec0);
    width: auto;
    flex-shrink: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a0aec0' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 9px 5px;
}

/* -- Expense modal: searchable suggestion fields -- */
.suggestion-field-wrap {
    position: relative;
}

.suggestion-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1200;
    background: white;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    max-height: 210px;
    overflow-y: auto;
    display: none;
}

.suggestion-list.active {
    display: block;
}

/* -- Expense detail page: fixed layout -- */
#expenseDetail-page.page.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#expenseDetailContent {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
