/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #2d3748;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeInUp 0.6s ease-out;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 30px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

header h1 {
    font-size: 3rem;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.property-name {
    font-size: 1.3rem;
    color: #718096;
    font-weight: 500;
}

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

.summary-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 32px 28px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.summary-card:hover::before {
    transform: scaleX(1);
}

.summary-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.summary-card h3 {
    font-size: 0.95rem;
    margin-bottom: 16px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
}

.cash-flow {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.income {
    color: #10b981;
    font-size: 2rem;
    font-weight: 800;
}

.expenses {
    color: #ef4444;
    font-size: 2rem;
    font-weight: 800;
}

.equity {
    color: #3b82f6; /* Using a blue color for equity */
    font-size: 2rem;
    font-weight: 800;
}

.percentage-info {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 8px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.average-info {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 4px;
    font-weight: 500;
    letter-spacing: 0.2px;
    display: block; /* Ensure it's on a new line */
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* Section Styles */
.data-entry {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.data-entry > h2,
.data-visualization > h2 {
    font-size: 1.8rem;
    color: #1a202c; /* Changed from white for better readability */
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); /* Reduced shadow for new color */
}

.section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.section:hover {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
}

.section h3 {
    color: #1a202c;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    font-size: 1.3rem;
    font-weight: 700;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-group input::placeholder {
    color: #a0aec0;
}

/* Form row for side-by-side fields */
.form-row {
    display: flex;
    gap: 16px;
}

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

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

button:active {
    transform: translateY(0);
}

/* Data Display */
#financialData {
    margin-top: 15px;
}

.no-data {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    padding: 32px 20px;
    font-size: 1.05rem;
}

/* Accordion Styles */
.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.accordion-item {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: white;
}

.accordion-item:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.accordion-item.expanded {
    border-color: #667eea;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    background: linear-gradient(to right, #f7fafc, #ffffff);
    transition: all 0.2s ease;
    user-select: none;
}

.accordion-header:hover {
    background: linear-gradient(to right, #edf2f7, #f7fafc);
}

.accordion-item.expanded .accordion-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.05));
}

.accordion-month {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.05rem;
    color: #1a202c;
}

.accordion-icon {
    color: #667eea;
    font-size: 0.9rem;
    transition: transform 0.2s ease;
    width: 16px;
    display: inline-block;
}

.accordion-summary {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.summary-item {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
    white-space: nowrap;
}

.income-summary {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.expense-summary {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.cashflow-summary {
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 700;
}

.cashflow-summary.positive {
    color: white;
    background: linear-gradient(135deg, #10b981, #059669);
}

.cashflow-summary.negative {
    color: white;
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.accordion-content {
    padding: 0 20px 16px 20px;
    animation: slideDown 0.3s ease-out;
}

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

.data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.95rem;
    transition: background 0.2s ease;
    border-radius: 6px;
    margin-bottom: 4px;
}

.data-item:hover {
    background: rgba(102, 126, 234, 0.05);
}

.data-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.data-item.amount-positive {
    color: #10b981;
    font-weight: 600;
}

.data-item.amount-negative {
    color: #ef4444;
    font-weight: 600;
}

.data-item.amount-neutral {
    color: #4a5568; /* Neutral color for mortgage/property value */
    font-weight: 600;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.delete-btn {
    background: transparent;
    color: #cbd5e0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    box-shadow: none;
    min-width: auto;
    font-weight: 700;
}

.delete-btn:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fecaca;
    transform: scale(1.1);
    box-shadow: none;
}

.delete-btn:active {
    transform: scale(0.95);
}

/* Chart Container */
.data-visualization {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Trend Chart Section */
.trend-chart-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 32px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    margin-bottom: 40px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.trend-chart-section h2 {
    margin-top: 0;
    margin-bottom: 24px;
    color: #1a202c;
    font-size: 1.8rem;
    font-weight: 700;
}

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

.trend-chart-section .chart-container {
    height: 350px;
}

#trendChart {
    border-radius: 12px;
}

#chart {
    border-radius: 12px;
}

#chartLegend {
    text-align: center;
    padding: 16px;
    background: #f7fafc;
    border-radius: 12px;
    margin-top: 16px;
}

#chartLegend p {
    margin: 8px 0;
    font-weight: 600;
    color: #4a5568;
    font-size: 1rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 28px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

footer button {
    margin: 0 10px;
    padding: 12px 24px;
}

footer button:last-child {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

footer button:last-child:hover {
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.5);
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .dashboard-summary {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    header {
        padding: 30px 20px;
        margin-bottom: 24px;
    }
    
    header h1 {
        font-size: 2.2rem;
    }
    
    .property-name {
        font-size: 1.1rem;
    }
    
    .summary-card {
        padding: 24px 20px;
    }
    
    .summary-card h3 {
        font-size: 0.85rem;
    }
    
    .cash-flow {
        font-size: 2rem;
    }
    
    .income,
    .expenses {
        font-size: 1.6rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-row .form-group {
        margin-bottom: 20px;
    }
    
    .data-entry > h2,
    .data-visualization > h2 {
        font-size: 1.5rem;
    }
    
    .section h3 {
        font-size: 1.15rem;
    }
    
    footer button {
        display: block;
        width: 100%;
        margin: 8px 0;
    }
    
    /* Accordion Responsive Styles */
    .accordion-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px 16px;
    }
    
    .accordion-month {
        font-size: 0.95rem;
    }
    
    .accordion-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        width: 100%;
    }
    
    .summary-item {
        font-size: 0.85rem;
        padding: 4px 10px;
    }
    
    .accordion-content {
        padding: 0 16px 12px 16px;
    }
    
    .data-item {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .item-actions {
        gap: 8px;
    }
    
    .delete-btn {
        padding: 3px 8px;
        font-size: 1.1rem;
    }
}

/* Category Colors */
.category-repairs { color: #3b82f6; }
.category-insurance { color: #8b5cf6; }
.category-strata { color: #f59e0b; }
.category-council { color: #10b981; }
.category-management { color: #6366f1; }
.category-tax { color: #14b8a6; }
.category-depreciation { color: #ef4444; }
.category-other { color: #64748b; }
