/* Ledger Page Styles */

/* Page Header */
.ledger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem 0;
    border-bottom: 3px solid #3498db;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border-radius: 8px 8px 0 0;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.ledger-header h2 {
    color: white;
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ledger-header h2 .material-symbols-outlined {
    font-size: 2rem;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #3498db;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.05) 0%, rgba(41, 128, 185, 0.1) 100%);
    z-index: 0;
}

.summary-card > * {
    position: relative;
    z-index: 1;
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.15);
}

.summary-card.income {
    border-left-color: #27ae60;
}

.summary-card.expense {
    border-left-color: #e74c3c;
}

.summary-card.balance {
    border-left-color: #f39c12;
}

.summary-card h3 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card .amount {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    color: #2c3e50;
}

.summary-card .change {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.summary-card .change.positive {
    color: #27ae60;
}

.summary-card .change.negative {
    color: #e74c3c;
}

/* Filter Section */
.filter-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #ecf0f1;
}

.filter-section h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
}

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

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #34495e;
}

.filter-group select,
.filter-group input {
    padding: 0.75rem;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-family: "Sansation", sans-serif;
    font-size: 0.9rem;
    background-color: white;
    transition: all 0.3s ease;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.filter-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Action Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: "Sansation", sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f5f8b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #7f8c8d 0%, #6c7b7d 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(149, 165, 166, 0.3);
}

/* Ledger Table */
.ledger-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.ledger-table {
    width: 100%;
    border-collapse: collapse;
    font-family: "Sansation", sans-serif;
}

.ledger-table thead {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    color: white;
}

.ledger-table thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 3px solid #3498db;
}

.ledger-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: all 0.3s ease;
}

.ledger-table tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

.ledger-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.ledger-table tbody tr:nth-child(even):hover {
    background-color: rgba(52, 152, 219, 0.08);
}

.ledger-table tbody td {
    padding: 1rem;
    color: #2c3e50;
    font-size: 0.9rem;
    vertical-align: middle;
}

.ledger-table .amount {
    font-weight: 600;
    text-align: right;
}

.ledger-table .amount.positive {
    color: #27ae60;
}

.ledger-table .amount.negative {
    color: #e74c3c;
}

.ledger-table .date {
    font-family: "Courier New", monospace;
    font-size: 0.85rem;
}

.ledger-table .status {
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.completed {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-badge.pending {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-badge.cancelled {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Action Buttons in Table */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.action-btn.edit {
    background-color: #3498db;
    color: white;
}

.action-btn.edit:hover {
    background-color: #2980b9;
    transform: scale(1.1);
}

.action-btn.delete {
    background-color: #e74c3c;
    color: white;
}

.action-btn.delete:hover {
    background-color: #c0392b;
    transform: scale(1.1);
}

.action-btn.view {
    background-color: #27ae60;
    color: white;
}

.action-btn.view:hover {
    background-color: #229954;
    transform: scale(1.1);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 2px solid #3498db;
    background-color: white;
    color: #3498db;
    border-radius: 6px;
    cursor: pointer;
    font-family: "Sansation", sans-serif;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
    background-color: #3498db;
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-info {
    color: #2c3e50;
    font-weight: 500;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: #7f8c8d;
}

.loading .material-symbols-outlined {
    font-size: 3rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #7f8c8d;
}

.empty-state .material-symbols-outlined {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .ledger-header {
        flex-direction: column;
        gap: 4vw;
        text-align: center;
    }

    .summary-cards {
        grid-template-columns: 1fr;
        gap: 4vw;
    }

    .filter-controls {
        grid-template-columns: 1fr;
        gap: 4vw;
    }

    .filter-actions {
        justify-content: center;
        gap: 3vw;
    }

    .ledger-table-container {
        overflow-x: auto;
        margin-bottom: 4vw;
    }

    .ledger-table {
        min-width: 160vw;
    }

    .action-buttons {
        flex-direction: column;
        gap: 1.5vw;
    }
}

@media (max-width: 768px) {
    .orders-header {
        gap: 4vw;
        text-align: center;
    }

    .orders-header .header-actions {
        gap: 3vw;
    }

    .orders-header .filter-controls {
        gap: 3vw;
        justify-content: center;
    }

    .orders-header .action-buttons {
        gap: 3vw;
    }

    .order-stats {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 4vw;
    }

    .stat-card {
        padding: 4vw;
    }

    .table-header {
        flex-direction: column;
        gap: 4vw;
        text-align: center;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100%;
        max-width: 100%;
        padding: 3.2vw 3.2vw 3.2vw 9vw;
        font-size: 3.8vw;
    }

    .data-table {
        font-size: 3.2vw;
    }

    .data-table th,
    .data-table td {
        padding: 2.5vw 1.5vw;
    }

    .table-pagination {
        flex-direction: column;
        gap: 4vw;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .summary-card {
        padding: 4vw;
    }

    .summary-card .amount {
        font-size: 5.4vw;
    }

    .filter-section {
        padding: 4vw;
    }

    .btn {
        padding: 2.5vw 4vw;
        font-size: 3.4vw;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 4.2vw;
    }

    .stat-icon {
        margin: 0 auto;
        width: 12vw;
        height: 12vw;
        font-size: 4.8vw;
    }

    /* Hide less important columns on mobile */
    .data-table th:nth-child(4),
    .data-table td:nth-child(4),
    .data-table th:nth-child(7),
    .data-table td:nth-child(7) {
        display: none;
    }
}

/* Header Styles to Match Orders Page */
.orders-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.orders-header h2 {
    color: #2c3e50;
    margin: 0;
}

.orders-header .header-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 1rem;
}

.orders-header .filter-controls {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 0.75rem;
}

.orders-header .filter-controls select {
    flex: 1 1 200px;
    min-width: 180px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    font-family: "Sansation", sans-serif;
    font-size: 0.9rem;
}

.orders-header .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.orders-header .action-buttons .btn-primary,
.orders-header .action-buttons .btn-secondary,
.orders-header .action-buttons button,
.orders-header .action-buttons a {
    width: 100%;
    justify-content: center;
}

.btn-primary,
.btn-secondary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-family: "Sansation", sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* Statement Statistics - Matching Orders Page */
.order-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    font-size: 1.3rem;
}

.stat-content h3 {
    margin: 0 0 0.5rem 0;
    color: #7f8c8d;
    font-size: 0.9rem;
    font-weight: 400;
}

.stat-content h2 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1.6rem;
    font-weight: 700;
}

.stat-change {
    font-size: 0.8rem;
    color: #27ae60;
}

/* Transaction Badge Styles - Moved from JavaScript for better architecture */
.type-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

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

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

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

/* Enhanced Transaction Table Styling to Match Orders Page */
.transaction-date {
    font-weight: 500;
}

.transaction-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.customer-info {
    display: flex;
    flex-direction: column;
}

.reference-info {
    font-family: monospace;
    color: #666;
}

.action-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.btn-icon:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

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

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

.status-badge.status-payment {
    background-color: #cce7ff;
    color: #004085;
}

.status-badge.status-completed {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-badge.status-cancelled {
    background-color: #f8d7da;
    color: #721c24;
}

/* Enhanced Table Styling */
#ledgerData tbody tr {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

#ledgerData tbody tr:hover {
    background-color: #f8f9fa;
}

#ledgerData td {
    padding: 12px 8px;
    vertical-align: middle;
}

/* Pagination Styling to Match Orders Page */
.pagination-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-family: "Sansation", sans-serif;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-number {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-family: "Sansation", sans-serif;
}

.page-number:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.page-number.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Transactions Table Container - Matching Orders Page */
.orders-table-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    margin-bottom: 2rem;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ecf0f1;
}

.table-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 0.75rem;
    color: #3498db;
    font-size: 1.2rem;
    z-index: 1;
}

.search-box input {
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    width: 400px;
    font-family: "Sansation", sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-box input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1), 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.search-box input::placeholder {
    color: #adb5bd;
    font-style: italic;
}

/* Table Wrapper */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: #f8f9fa;
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.data-table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Table Pagination - Inside Container */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0 0 0;
    margin-top: 1rem;
    border-top: 1px solid #ecf0f1;
}

.pagination-info {
    color: #6c757d;
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Enhanced Table Styling */
.data-table th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 1;
}

.data-table th:first-child {
    border-top-left-radius: 8px;
}

.data-table th:last-child {
    border-top-right-radius: 8px;
}

/* Action buttons in table */
.table-wrapper .action-buttons .btn-icon {
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #e9ecef;
}

.table-wrapper .action-buttons .btn-icon:hover {
    background-color: #e9ecef;
    color: #212529;
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #495057;
}

.empty-state p {
    margin-bottom: 1.5rem;
}
