/**
 * Accounting Module Styles
 * Styles for the microfinance accounting system
 * Includes: Navigation, Account Tree, Journal Entry Forms, Reports, Dashboard
 */

/* ============================================
   Navigation Styles
   ============================================ */

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
    color: #00308a;
    border-bottom-color: #86c662;
}

.nav-link.active {
    color: #00308a;
    border-bottom-color: #00308a;
    font-weight: 600;
}

.dark .nav-link {
    color: #9ca3af;
}

.dark .nav-link:hover {
    color: #86c662;
}

.dark .nav-link.active {
    color: #86c662;
}

/* ============================================
   Account List Hierarchical Tree View
   ============================================ */

.account-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.account-tree-item {
    position: relative;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}

.dark .account-tree-item {
    border-bottom-color: #374151;
}

.account-tree-item:hover {
    background-color: #f9fafb;
}

.dark .account-tree-item:hover {
    background-color: #1f2937;
}

.account-tree-item.level-0 {
    font-weight: 600;
    background-color: #f3f4f6;
}

.dark .account-tree-item.level-0 {
    background-color: #111827;
}

.account-tree-item.level-1 {
    padding-left: 2rem;
}

.account-tree-item.level-2 {
    padding-left: 3rem;
}

.account-tree-item.level-3 {
    padding-left: 4rem;
}

.account-tree-item.level-4 {
    padding-left: 5rem;
}

.account-indent {
    display: inline-block;
    color: #9ca3af;
    margin-right: 0.5rem;
}

.account-code {
    display: inline-block;
    min-width: 5rem;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #4b5563;
}

.dark .account-code {
    color: #d1d5db;
}

.account-name {
    flex: 1;
    color: #1f2937;
}

.dark .account-name {
    color: #f3f4f6;
}

.account-balance {
    font-weight: 600;
    text-align: right;
    min-width: 8rem;
}

.account-balance.positive {
    color: #059669;
}

.account-balance.negative {
    color: #dc2626;
}

/* ============================================
   Journal Entry Form Styles
   ============================================ */

.journal-entry-form {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.dark .journal-entry-form {
    background: #1f2937;
}

.journal-line-item {
    position: relative;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.dark .journal-line-item {
    background: #111827;
    border-color: #374151;
}

.journal-line-item:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.journal-line-item.deleted {
    opacity: 0.5;
    background-color: #fee;
}

.dark .journal-line-item.deleted {
    background-color: #3f1f1f;
}

.journal-line-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    background: linear-gradient(135deg, #00308a 0%, #002266 100%);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

.journal-line-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    color: #ef4444;
    cursor: pointer;
    transition: color 0.2s ease;
}

.journal-line-remove:hover {
    color: #dc2626;
}

.journal-totals-panel {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 2px solid #e5e7eb;
}

.dark .journal-totals-panel {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-color: #374151;
}

.journal-total-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.dark .journal-total-item {
    border-bottom-color: #4b5563;
}

.journal-total-item:last-child {
    border-bottom: none;
    font-size: 1.25rem;
    font-weight: 700;
}

.balance-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.balance-indicator.balanced {
    background: #d1fae5;
    color: #065f46;
}

.dark .balance-indicator.balanced {
    background: #064e3b;
    color: #86efac;
}

.balance-indicator.unbalanced {
    background: #fee2e2;
    color: #991b1b;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.dark .balance-indicator.unbalanced {
    background: #7f1d1d;
    color: #fca5a5;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* ============================================
   Financial Reports Styles
   ============================================ */

.report-container {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.dark .report-container {
    background: #1f2937;
}

.report-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #00308a;
}

.report-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #00308a;
    margin-bottom: 0.5rem;
}

.dark .report-title {
    color: #86c662;
}

.report-subtitle {
    font-size: 1rem;
    color: #6b7280;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.report-table thead th {
    background: linear-gradient(135deg, #00308a 0%, #002266 100%);
    color: white;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.report-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    color: #1f2937;
}

.dark .report-table tbody td {
    border-bottom-color: #374151;
    color: #f3f4f6;
}

.report-table tbody tr:hover {
    background: #f9fafb;
}

.dark .report-table tbody tr:hover {
    background: #111827;
}

.report-table .amount-column {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.report-table .total-row {
    font-weight: 700;
    background: #f3f4f6;
    border-top: 2px solid #00308a;
    border-bottom: 2px solid #00308a;
}

.dark .report-table .total-row {
    background: #374151;
}

.report-table .subtotal-row {
    font-weight: 600;
    background: #f9fafb;
    border-top: 1px solid #d1d5db;
}

.dark .report-table .subtotal-row {
    background: #1f2937;
}

.report-section-header {
    background: #e5e7eb;
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.dark .report-section-header {
    background: #374151;
    color: #d1d5db;
}

.report-indent-1 {
    padding-left: 2rem;
}

.report-indent-2 {
    padding-left: 3rem;
}

.report-indent-3 {
    padding-left: 4rem;
}

.report-export-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.report-filter-panel {
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
}

.dark .report-filter-panel {
    background: #111827;
    border-color: #374151;
}

/* ============================================
   Dashboard Widget Styles
   ============================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-widget {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .dashboard-widget {
    background: #1f2937;
    border-color: #374151;
}

.dashboard-widget:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.widget-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dark .widget-title {
    color: #9ca3af;
}

.widget-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.widget-icon.primary {
    background: linear-gradient(135deg, rgba(0, 48, 138, 0.1) 0%, rgba(0, 48, 138, 0.2) 100%);
    color: #00308a;
}

.widget-icon.secondary {
    background: linear-gradient(135deg, rgba(134, 198, 98, 0.1) 0%, rgba(134, 198, 98, 0.2) 100%);
    color: #86c662;
}

.widget-icon.success {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.1) 0%, rgba(5, 150, 105, 0.2) 100%);
    color: #059669;
}

.widget-icon.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.2) 100%);
    color: #f59e0b;
}

.widget-icon.danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.2) 100%);
    color: #ef4444;
}

.widget-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.dark .widget-value {
    color: #f3f4f6;
}

.widget-label {
    font-size: 0.875rem;
    color: #6b7280;
}

.dark .widget-label {
    color: #9ca3af;
}

.widget-trend {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.widget-trend.up {
    background: #d1fae5;
    color: #065f46;
}

.dark .widget-trend.up {
    background: #064e3b;
    color: #86efac;
}

.widget-trend.down {
    background: #fee2e2;
    color: #991b1b;
}

.dark .widget-trend.down {
    background: #7f1d1d;
    color: #fca5a5;
}

.metrics-card {
    background: linear-gradient(135deg, #00308a 0%, #002266 100%);
    color: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 48, 138, 0.3);
}

.metrics-card-secondary {
    background: linear-gradient(135deg, #86c662 0%, #73b554 100%);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .account-tree-item {
        font-size: 0.875rem;
    }
    
    .account-tree-item.level-1 {
        padding-left: 1rem;
    }
    
    .account-tree-item.level-2 {
        padding-left: 1.5rem;
    }
    
    .account-tree-item.level-3 {
        padding-left: 2rem;
    }
    
    .account-tree-item.level-4 {
        padding-left: 2.5rem;
    }
    
    .journal-line-item {
        padding: 0.75rem;
    }
    
    .report-container {
        padding: 1rem;
    }
    
    .report-table {
        font-size: 0.875rem;
    }
    
    .report-table thead th,
    .report-table tbody td {
        padding: 0.5rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .widget-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 640px) {
    .nav-link {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .nav-link i {
        display: none;
    }
    
    .report-header {
        margin-bottom: 1rem;
    }
    
    .report-title {
        font-size: 1.5rem;
    }
    
    .journal-totals-panel {
        padding: 1rem;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .nav-link,
    .report-export-buttons,
    .report-filter-panel,
    .widget-trend,
    .journal-line-remove {
        display: none !important;
    }
    
    .report-container {
        box-shadow: none;
        padding: 0;
    }
    
    .report-table {
        page-break-inside: auto;
    }
    
    .report-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    .report-table thead {
        display: table-header-group;
    }
}

/* ============================================
   Utility Classes
   ============================================ */

.text-positive {
    color: #059669;
}

.text-negative {
    color: #dc2626;
}

.bg-success-light {
    background-color: #d1fae5;
}

.dark .bg-success-light {
    background-color: #064e3b;
}

.bg-danger-light {
    background-color: #fee2e2;
}

.dark .bg-danger-light {
    background-color: #7f1d1d;
}

.border-success {
    border-color: #059669;
}

.border-danger {
    border-color: #dc2626;
}
