/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Times New Roman', Times, serif;
    background-color: #1a1a1a;
    color: #ffffff;
    line-height: 1.6;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #000000, #333333);
    border-radius: 10px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #ffffff;
}

header p {
    font-size: 1.2em;
    color: #cccccc;
}

/* Main Container */
main {
    max-width: 1200px;
    margin: 0 auto;
}

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

.card {
    background: #2a2a2a;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 1px solid #444;
}

.card h2 {
    font-size: 1.3em;
    color: #cccccc;
    margin-bottom: 10px;
}

.card p {
    font-size: 2em;
    font-weight: bold;
    color: #ffffff;
}

#balance { color: #4CAF50; }
#income { color: #2196F3; }
#expenses { color: #f44336; }

/* Add Section */
.add-section {
    background: #2a2a2a;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 1px solid #444;
}

.add-section h2 {
    margin-bottom: 20px;
    color: #ffffff;
}

#transactionForm {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

#transactionForm label {
    display: block;
    margin-bottom: 5px;
    color: #cccccc;
    font-weight: bold;
}

#transactionForm input,
#transactionForm select {
    width: 100%;
    padding: 12px;
    border: 1px solid #555;
    border-radius: 5px;
    background: #333;
    color: #ffffff;
    font-size: 1em;
    font-family: inherit;
}

#transactionForm button {
    grid-column: 1 / -1;
    padding: 15px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

#transactionForm button:hover {
    background: #45a049;
}

/* Filters */
.filters {
    background: #2a2a2a;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 1px solid #444;
}

.filters label {
    color: #cccccc;
    font-weight: bold;
    white-space: nowrap;
}

.filters select,
.filters input {
    padding: 10px;
    border: 1px solid #555;
    border-radius: 5px;
    background: #333;
    color: #ffffff;
    font-family: inherit;
}

#clearFilters {
    background: #f44336;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

#clearFilters:hover {
    background: #d32f2f;
}

/* Transactions Table */
.transactions-section {
    margin-bottom: 40px;
}

.transactions-section h2 {
    color: #ffffff;
    margin-bottom: 20px;
}

#transactionTable {
    width: 100%;
    background: #2a2a2a;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 1px solid #444;
}

#transactionTable thead {
    background: #000000;
}

#transactionTable th,
#transactionTable td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #444;
}

#transactionTable th {
    background: #333;
    color: #cccccc;
    font-weight: bold;
}

.income { color: #4CAF50; }
.expense { color: #f44336; }

.delete-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.delete-btn:hover {
    background: #d32f2f;
}

.edit-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 5px;
}

.edit-btn:hover {
    background: #1976D2;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #444;
    border-radius: 4px;
    overflow: hidden;
    margin: 5px 0;
}

.progress-bar div {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.3s ease;
}

.budget-item small {
    color: #ccc;
}

.loader {
    border: 4px solid #333;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Analytics */
.analytics-section {
    background: #2a2a2a;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 1px solid #444;
}

.analytics-section h2 {
    color: #ffffff;
    margin-bottom: 20px;
}

.chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 20px;
}

#analyticsChart {
    width: 100%;
    height: 100%;
    border: 1px solid #555;
    border-radius: 5px;
}

#monthlySummary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* New Premium Styles */
.insights-section, .category-section, .tips-section, .budget-section {
    background: #2a2a2a;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 1px solid #444;
}

.insights-section h2, .category-section h2, .tips-section h2, .budget-section h2 {
    color: #ffffff;
    margin-bottom: 20px;
}

#insightsCards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.insights-card {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.budget-warning {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 5px solid #ff5722;
}

#tipsCarousel {
    position: relative;
    height: 120px;
    overflow: hidden;
    border-radius: 10px;
    background: #333;
    padding: 20px;
}

.tip-item {
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.tip-item.active {
    opacity: 1;
}

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

#currentBudgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.budget-item {
    background: #333;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #2a2a2a;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 30px;
    cursor: pointer;
    color: #ccc;
}

.close:hover {
    color: #fff;
}

#editForm {
    display: grid;
    gap: 15px;
}

#editForm label {
    color: #ccc;
    font-weight: bold;
}

#editForm input, #editForm select {
    padding: 12px;
    border: 1px solid #555;
    border-radius: 5px;
    background: #333;
    color: #fff;
}

#editForm button {
    padding: 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

#editForm button[type="submit"] {
    background: #4CAF50;
    color: white;
}

#cancelEdit {
    background: #666;
    color: white;
}

/* Animations */
@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes countUp {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.new-row {
    animation: slideIn 0.5s ease-out;
}

.smooth-fade {
    transition: opacity 0.3s ease;
}

.summary-grid .card p {
    animation: countUp 1s ease-out;
}

/* Pie Chart */
#categoryChart {
    border: 1px solid #555;
    border-radius: 5px;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    margin-top: 50px;
    background: #000000;
    border-radius: 10px;
    color: #cccccc;
}

/* Responsive */
@media (max-width: 768px) {
    body { padding: 10px; }
    
    header h1 { font-size: 2em; }
    
    #transactionForm, .budget-section form, #editForm { grid-template-columns: 1fr; }
    
    .filters, .modal-content { flex-direction: column; align-items: stretch; }
    
    .filters label, .budget-section label { margin-bottom: 5px; }
    
    #transactionTable th, #transactionTable td { padding: 10px; font-size: 0.9em; }
    
    .summary-grid, #insightsCards, #currentBudgets { grid-template-columns: 1fr; }
    
    .chart-container { height: 300px !important; }
}
