/* Personal Accounting System Styles - استایل سیستم حسابداری شخصی */

.accounting-container {
    padding: 20px;
}

/* Currency Selector Section */
.currency-selector-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.currency-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.currency-selector-header h3 {
    margin: 0;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.currency-select {
    padding: 8px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
}

.currency-select:hover {
    background: white;
    border-color: white;
}

.currency-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.currency-badge {
    display: inline-flex;
    align-items: center;
    background: #ffc107;
    color: #000;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-right: 5px;
}

.amount-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.original-amount {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 2px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.flex-1 {
    flex: 1;
}

.flex-2 {
    flex: 2;
}

/* Person Filter Section */
.person-filter-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.person-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.person-filter-header h3 {
    margin: 0;
    color: #212529;
    display: flex;
    align-items: center;
    gap: 10px;
}

.person-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.person-chip {
    padding: 8px 16px;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #495057;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.person-chip:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.person-chip.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.person-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #495057;
    margin-right: 8px;
}

/* Persons Report */
.persons-report {
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
}

.person-report-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid #dee2e6;
}

.person-info h4 {
    margin: 0 0 10px 0;
    color: #212529;
    display: flex;
    align-items: center;
    gap: 8px;
}

.person-balance {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 15px 0;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.balance-item.net-balance {
    grid-column: 1 / -1;
    background: #e7f3ff;
    border-color: #007bff;
}

.person-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.large-modal {
    max-width: 800px;
}

/* Balance Cards */
.accounting-header {
    margin-bottom: 30px;
}

.balance-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.balance-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.balance-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.balance-card .card-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.balance-card.income .card-icon {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.balance-card.expense .card-icon {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
}

.balance-card.debt .card-icon {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
}

.balance-card.credit .card-icon {
    background: linear-gradient(135deg, #17a2b8, #007bff);
}

.balance-card.net .card-icon {
    background: linear-gradient(135deg, #6f42c1, #6610f2);
}

.balance-card .card-content h4 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 600;
}

.balance-card .card-content .amount {
    margin: 0;
    font-size: 1.3rem;
    font-weight: bold;
    color: #212529;
}

.balance-card .card-content .amount.positive {
    color: #28a745;
}

.balance-card .card-content .amount.negative {
    color: #dc3545;
}

/* Actions Bar */
.accounting-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex: 1;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #495057;
}

.filter-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.filter-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Transactions Container */
.transactions-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.transactions-container h3 {
    margin: 0 0 20px 0;
    color: #212529;
    display: flex;
    align-items: center;
    gap: 10px;
}

.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.transaction-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    padding: 15px;
    border-radius: 8px;
    border-right: 4px solid;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.transaction-item:hover {
    background: #e9ecef;
    transform: translateX(-5px);
}

.transaction-item.income {
    border-right-color: #28a745;
}

.transaction-item.expense {
    border-right-color: #dc3545;
}

.transaction-item.debt {
    border-right-color: #ffc107;
}

.transaction-item.credit {
    border-right-color: #17a2b8;
}

.transaction-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.transaction-main > div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.transaction-main strong {
    color: #212529;
    font-size: 1rem;
}

.transaction-main .amount {
    font-size: 1.1rem;
    font-weight: bold;
    color: #495057;
}

.transaction-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #6c757d;
    gap: 10px;
}

.transaction-meta .description-text {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-meta i {
    opacity: 0.7;
}

.transaction-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.transaction-actions button {
    background: transparent;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.transaction-actions button:hover {
    background: #dc3545;
    color: white;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 1.1rem;
    margin: 0;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.accounting-modal {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.accounting-modal h3 {
    margin: 0 0 20px 0;
    color: #212529;
}

.accounting-modal .form-group {
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.accounting-modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 0.95rem;
}

#custom-category-group {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.accounting-modal select,
.accounting-modal input,
.accounting-modal textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.accounting-modal textarea {
    resize: vertical;
    min-height: 80px;
}

.accounting-modal select:focus,
.accounting-modal input:focus,
.accounting-modal textarea:focus {
    outline: none;
    border-color: #007bff;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-dark {
    background: #343a40;
    color: white;
}

.btn-dark:hover {
    background: #23272b;
}

/* Dark Theme */
[data-theme="dark"] .balance-card,
[data-theme="dark"] .accounting-actions,
[data-theme="dark"] .transactions-container,
[data-theme="dark"] .person-filter-section {
    background: #2d2d2d;
}

[data-theme="dark"] .currency-selector-section {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

[data-theme="dark"] .currency-select {
    background: #1e1e1e;
    color: #e0e0e0;
    border-color: #444;
}

[data-theme="dark"] .currency-select:hover {
    background: #252525;
}

[data-theme="dark"] .original-amount {
    color: #9ca3af;
}

[data-theme="dark"] .person-filter-header h3,
[data-theme="dark"] .person-info h4,
[data-theme="dark"] .balance-card .card-content h4,
[data-theme="dark"] .balance-card .card-content .amount,
[data-theme="dark"] .transactions-container h3,
[data-theme="dark"] .transaction-main strong {
    color: #fff;
}

[data-theme="dark"] .person-chip {
    background: #1e1e1e;
    color: #e0e0e0;
    border-color: #444;
}

[data-theme="dark"] .person-chip:hover {
    background: #252525;
}

[data-theme="dark"] .person-chip.active {
    background: #007bff;
    color: white;
}

[data-theme="dark"] .person-badge {
    background: #444;
    color: #e0e0e0;
}

[data-theme="dark"] .person-report-card {
    background: #1e1e1e;
    border-color: #444;
}

[data-theme="dark"] .balance-item {
    background: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
}

[data-theme="dark"] .balance-item.net-balance {
    background: #1a3a52;
    border-color: #007bff;
}

[data-theme="dark"] .transaction-item {
    background: #1e1e1e;
}

[data-theme="dark"] .transaction-item:hover {
    background: #252525;
}

[data-theme="dark"] .accounting-modal {
    background: #2d2d2d;
    color: #fff;
}

[data-theme="dark"] .accounting-modal h3 {
    color: #fff;
}

[data-theme="dark"] .accounting-modal .form-group label {
    color: #e0e0e0;
}

[data-theme="dark"] .accounting-modal select,
[data-theme="dark"] .accounting-modal input,
[data-theme="dark"] .accounting-modal textarea {
    background: #1e1e1e;
    color: #fff;
    border-color: #444;
}

/* Responsive */
@media (max-width: 768px) {
    .balance-cards {
        grid-template-columns: 1fr;
    }
    
    .accounting-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-buttons {
        width: 100%;
    }
    
    .transaction-item {
        grid-template-columns: 1fr;
    }
}


/* Person List Styles */
.persons-list-by-type {
    max-height: 600px;
    overflow-y: auto;
}

.person-type-section {
    margin-bottom: 24px;
}

.person-type-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.person-type-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.person-list-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.person-list-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.person-list-info h5 {
    margin: 0 0 4px 0;
    color: #1a202c;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.person-list-info p {
    margin: 0;
    color: #718096;
}

.person-list-balance {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.balance-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.balance-badge.income {
    background: #d4edda;
    color: #155724;
}

.balance-badge.expense {
    background: #f8d7da;
    color: #721c24;
}

.balance-badge.debt {
    background: #fff3cd;
    color: #856404;
}

.balance-badge.credit {
    background: #d1ecf1;
    color: #0c5460;
}

/* Person Details Modal */
.person-details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.person-details-header h3 {
    margin: 0 0 8px 0;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 10px;
}

.person-details-header .badge {
    display: inline-block;
    padding: 4px 12px;
    background: #667eea;
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 8px;
}

.person-balance-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.balance-summary-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.balance-summary-item i {
    font-size: 2rem;
    opacity: 0.8;
}

.balance-summary-item.income {
    border-color: #48bb78;
}

.balance-summary-item.income i {
    color: #48bb78;
}

.balance-summary-item.expense {
    border-color: #f56565;
}

.balance-summary-item.expense i {
    color: #f56565;
}

.balance-summary-item.debt {
    border-color: #ed8936;
}

.balance-summary-item.debt i {
    color: #ed8936;
}

.balance-summary-item.credit {
    border-color: #4299e1;
}

.balance-summary-item.credit i {
    color: #4299e1;
}

.balance-summary-item div {
    display: flex;
    flex-direction: column;
}

.balance-summary-item span {
    font-size: 0.85rem;
    color: #718096;
}

.balance-summary-item strong {
    font-size: 1.2rem;
    color: #1a202c;
}

.person-transactions {
    margin-top: 24px;
}

.person-transactions h4 {
    margin: 0 0 16px 0;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 10px;
}

.transactions-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.transaction-row {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.transaction-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.transaction-row.income {
    border-right: 4px solid #48bb78;
}

.transaction-row.expense {
    border-right: 4px solid #f56565;
}

.transaction-row.debt {
    border-right: 4px solid #ed8936;
}

.transaction-row.credit {
    border-right: 4px solid #4299e1;
}

.transaction-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.transaction-type-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.transaction-type-badge.income {
    background: #d4edda;
    color: #155724;
}

.transaction-type-badge.expense {
    background: #f8d7da;
    color: #721c24;
}

.transaction-type-badge.debt {
    background: #fff3cd;
    color: #856404;
}

.transaction-type-badge.credit {
    background: #d1ecf1;
    color: #0c5460;
}

.transaction-desc {
    color: #1a202c;
    font-weight: 500;
}

.transaction-date {
    color: #718096;
    font-size: 0.85rem;
}

.transaction-amount {
    font-weight: 700;
    font-size: 1.1rem;
    text-align: left;
}

.transaction-amount.income {
    color: #48bb78;
}

.transaction-amount.expense {
    color: #f56565;
}

.transaction-amount.debt {
    color: #ed8936;
}

.transaction-amount.credit {
    color: #4299e1;
}

/* ── Accounting UI enhancements ── */

.person-filter-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.active-person-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 14px;
    background: #e7f3ff;
    border: 1px solid #b6d4fe;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #084298;
}

.person-chip-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.person-chip-wrap.active .person-chip {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.person-chip-detail {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #495057;
    transition: all 0.2s ease;
}

.person-chip-detail:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.net-balance-card .card-icon {
    background: linear-gradient(135deg, #17a2b8, #138496);
}

.transaction-type-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e9ecef;
    color: #495057;
}

.transaction-item {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
}

.transaction-main {
    grid-column: 1;
    grid-row: 1;
}

.transaction-meta {
    grid-column: 1;
    grid-row: 2;
}

.transaction-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
}

.transaction-actions button:first-child {
    color: #007bff;
}

.transaction-actions button:first-child:hover {
    background: #007bff;
    color: white;
}

.empty-text {
    color: #6c757d;
    padding: 20px;
}

.text-green { color: #28a745; }
.text-red { color: #dc3545; }
.text-orange { color: #fd7e14; }
.text-black { color: #007bff; }
.text-sm { font-size: 0.875rem; }
.text-center { text-align: center; }

.person-list-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

[data-theme="dark"] .active-person-banner {
    background: #1a3a52;
    border-color: #007bff;
    color: #cce5ff;
}

[data-theme="dark"] .person-chip-detail {
    background: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
}

[data-theme="dark"] .transaction-type-label {
    background: #444;
    color: #e0e0e0;
}
