/* Main Styles */
body {
    font-family: 'Kanit', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.main-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    margin: 20px 0;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 20px 20px 0 0;
    text-align: center;
}

.btn-add {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    border-radius: 50px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(40, 167, 69, 0.3);
    background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    border: none;
    border-radius: 50px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #212529;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 193, 7, 0.3);
    background: linear-gradient(135deg, #e0a800 0%, #e68900 100%);
    color: #212529;
}

/* Monthly Table Styles */
.monthly-table {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
    border: none;
    margin-bottom: 30px;
}

.table-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    border: none;
}

.table-header th {
    border: none;
    padding: 20px 15px;
    font-size: 1.1em;
    text-align: center;
    position: relative;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.table-header th:first-child {
    border-radius: 0;
    text-align: left;
}

.table-header th:last-child {
    border-radius: 0;
}

.month-cell {
    background: transparent;
    border: none;
    padding: 20px 15px;
    text-align: center;
    vertical-align: middle;
    position: relative;
}

.month-cell:not(:first-child) {
    border-left: 1px solid #f0f0f0;
}

.payment-item {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 4px 0;
    font-size: 1em;
    font-weight: 600;
    color: #2e7d32;
    text-align: center;
    border: 2px solid #e8f5e8;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.1);
    animation: fadeInUp 0.5s ease-out;
    position: relative;
}

.payment-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(76, 175, 80, 0.05) 100%);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.payment-item:hover::before {
    opacity: 1;
}

.payment-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.2);
    border-color: #4caf50;
}

.total-amount {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    border-radius: 15px;
    padding: 15px 20px;
    font-weight: 700;
    color: white;
    text-align: center;
    margin-top: 15px;
    font-size: 1.2em;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
    border: none;
    transition: all 0.3s ease;
}

.total-amount:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.item-name-cell {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 20px 15px;
    text-align: left;
    font-weight: 600;
    color: white;
    border-radius: 0;
    position: relative;
}

.item-name-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.item-name-cell:hover::before {
    opacity: 1;
}

.item-name-cell strong {
    font-size: 1.1em;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.item-name-cell small {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
}

.card-type-badge {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
    margin-top: 5px;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.item-name-cell .card-type-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Table Row Styles */
.table tbody tr {
    border: none;
}

.table tbody tr:nth-child(even) {
    background-color: rgba(248, 249, 250, 0.5);
}

.table tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

.total-row {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%) !important;
    border-top: 3px solid #ff9800;
}

.total-row .month-cell {
    background: transparent;
    font-weight: 700;
    color: #e65100;
}

.total-row .item-name-cell {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
}

.total-row .item-name-cell strong {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Empty and Zero Amount Styles */
.month-cell:empty {
    background: rgba(248, 249, 250, 0.3);
}

.month-cell:empty::after {
    content: "—";
    color: #adb5bd;
    font-style: italic;
}

.total-amount.zero-amount {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    color: #6c757d;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.1);
}

.total-amount.zero-amount:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.1);
}

/* Negative Amount Styles */
.negative-amount {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%) !important;
    color: #d32f2f !important;
    border-color: #ffcdd2 !important;
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.1) !important;
}

.negative-amount::before {
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.1) 0%, rgba(211, 47, 47, 0.05) 100%) !important;
}

.negative-amount:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.2) !important;
    border-color: #f44336 !important;
}

/* Total Amount Negative */
.total-amount.negative-amount {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3) !important;
}

.total-amount.negative-amount:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4) !important;
}

/* Card Total Amount Negative */
.card-total-amount.negative-amount {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%) !important;
    color: #d32f2f !important;
    border-color: #ffcdd2 !important;
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.1) !important;
}

.card-total-amount.negative-amount:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.2) !important;
    border-color: #f44336 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .monthly-table {
        border-radius: 15px;
    }
    
    .table-header th {
        padding: 15px 8px;
        font-size: 0.9em;
    }
    
    .month-cell {
        padding: 15px 8px;
    }
    
    .payment-item {
        padding: 8px 12px;
        font-size: 0.9em;
        margin: 2px 0;
    }
    
    .total-amount {
        padding: 12px 15px;
        font-size: 1.1em;
    }
    
    .item-name-cell {
        padding: 15px 8px;
    }
    
    .item-name-cell strong {
        font-size: 1em;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover Effects */
.month-cell:hover {
    background-color: rgba(102, 126, 234, 0.02);
}

.item-name-cell:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.total-row .item-name-cell:hover {
    background: linear-gradient(135deg, #e55a2b 0%, #e0851a 100%);
}

/* Modal Styles */
.modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 12px 15px;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

/* Credit List Styles */
.credit-list {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.credit-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.credit-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-delete {
    background: #dc3545;
    border: none;
    border-radius: 50px;
    padding: 8px 15px;
    color: white;
    transition: all 0.3s ease;
}

.btn-delete:hover {
    background: #c82333;
    transform: scale(1.05);
}

.btn-edit {
    background: #ffc107;
    border: none;
    border-radius: 50px;
    padding: 8px 15px;
    color: white;
    transition: all 0.3s ease;
    margin-right: 5px;
}

.btn-edit:hover {
    background: #e0a800;
    transform: scale(1.05);
}

.alert {
    border-radius: 15px;
    border: none;
}

/* Balloon Notification Styles */
.balloon-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.3s ease-out;
    backdrop-filter: blur(10px);
}

.balloon-notification.success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border-left: 4px solid #1e7e34;
}

.balloon-notification.danger {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    color: white;
    border-left: 4px solid #c82333;
}

.balloon-notification.warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: white;
    border-left: 4px solid #e0a800;
}

.balloon-notification.info {
    background: linear-gradient(135deg, #17a2b8, #6f42c1);
    color: white;
    border-left: 4px solid #138496;
}

.balloon-content {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.balloon-message {
    flex: 1;
    margin-right: 10px;
}

.balloon-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.balloon-close:hover {
    opacity: 1;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.balloon-notification.hide {
    animation: slideOutRight 0.3s ease-in forwards;
}

/* Year Selector Styles */
.year-selector-container {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #dee2e6;
}

.year-selector-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.year-selector-select {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 1.1em;
    font-weight: 500;
    color: #495057;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-width: 120px;
}

.year-selector-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    outline: none;
}

.year-selector-select:hover {
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.year-selector-icon {
    color: #667eea;
    margin-right: 8px;
}

/* Card Total Row Styles */
.card-total-row {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%) !important;
    border-top: 2px solid #4caf50;
    border-bottom: 2px solid #4caf50;
}

.card-total-cell {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    border: none;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: white;
    border-radius: 0;
    position: relative;
}

.card-total-cell strong {
    font-size: 0.95em;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card-total-cell small {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75em;
}

.card-total-amount {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 600;
    color: white;
    text-align: center;
    margin-top: 8px;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
    border: none;
    transition: all 0.3s ease;
}

.card-total-amount:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.card-total-row .month-cell {
    background: transparent;
    font-weight: 600;
    color: #2e7d32;
}

.card-total-row:hover {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%) !important;
}

.card-total-cell:hover {
    background: linear-gradient(135deg, #388e3c 0%, #2e7d32 100%);
}

/* Group separation */
.card-total-row + tr:not(.card-total-row) {
    border-top: 3px solid #e0e0e0;
}

/* Date Input Styles */
.date-input {
    background-color: #fff;
    cursor: pointer;
    position: relative;
}

.date-input:hover {
    border-color: #80bdff;
}

.date-input:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Custom styling for date input */
.date-input::-webkit-calendar-picker-indicator {
    background: transparent;
    bottom: 0;
    color: transparent;
    cursor: pointer;
    height: auto;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
}

.date-input::-webkit-datetime-edit {
    color: #495057;
}

.date-input::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

.date-input::-webkit-datetime-edit-text {
    color: #6c757d;
    padding: 0 0.2em;
}

.date-input::-webkit-datetime-edit-month-field,
.date-input::-webkit-datetime-edit-day-field,
.date-input::-webkit-datetime-edit-year-field {
    color: #495057;
    padding: 0 0.2em;
}

.date-input::-webkit-inner-spin-button {
    display: none;
}

.date-input::-webkit-clear-button {
    display: none;
}

/* Credit List Negative Amount */
.credit-item .negative-amount {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #d32f2f;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    display: inline-block;
    border: 1px solid #ffcdd2;
    box-shadow: 0 1px 3px rgba(211, 47, 47, 0.1);
}

.credit-item .negative-amount:hover {
    background: linear-gradient(135deg, #ffcdd2 0%, #ef9a9a 100%);
    border-color: #ef9a9a;
    box-shadow: 0 2px 6px rgba(211, 47, 47, 0.2);
}

/* Installment Info Styles */
.installment-info {
    color: #666;
    font-size: 0.75em;
    font-weight: 500;
    opacity: 0.8;
    margin-top: 2px;
    display: block;
    text-align: center;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 2px 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.payment-item:hover .installment-info {
    opacity: 1;
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
}

.negative-amount .installment-info {
    color: #d32f2f;
    background: rgba(211, 47, 47, 0.1);
    border-color: rgba(211, 47, 47, 0.2);
}

/* Pagination Styles */
.pagination-container {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #dee2e6;
}

.pagination {
    margin-bottom: 0;
}

.page-link {
    background: white;
    border: 2px solid #e9ecef;
    color: #495057;
    font-weight: 500;
    padding: 10px 15px;
    margin: 0 2px;
    border-radius: 10px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.page-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.page-item.disabled .page-link {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-item.disabled .page-link:hover {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #6c757d;
    transform: none;
    box-shadow: none;
} 