/* Base styles */
body {
    min-height: 100vh;
    background: var(--background-gradient);
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 0.5rem;
}

/* Language selector */
.language-select {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.language-select select {
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    outline: none;
    background-color: white;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.language-select select:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    background-color: var(--primary-light);
    border-radius: 0.5rem;
    padding: 0.125rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    text-align: center;
    font-size: 0.875rem;
    text-decoration: none;
    color: #374151;
    transition: background-color 0.3s, color 0.3s;
    background-color: white;
    border: 1px solid var(--primary-color);
}

.tab:hover {
    background-color: var(--accent-color);
    color: white;
}

.tab-active, .tab-active:hover {
    background-color: var(--primary-color);
    color: white !important;
}

/* Main content layout */
.main-content {
    display: flex;
    gap: 0.75rem;
}

.content-left {
    flex-grow: 1;
}

.content-right {
    width: 288px;
    flex-shrink: 0;
}

/* Categories and items */
.category {
    margin-bottom: 0.75rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.category-header {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

.category-header h2 {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1;
    margin: 0;
}

.grid-header {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #f0fdf4;
    font-size: 0.875rem;
    font-weight: 500;
    color: #15803d;
}

.col-span-4 {
    grid-column: span 4 / span 4;
}

.text-center {
    text-align: center;
}

.budget-row {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    min-height: 2rem;
    align-items: center;
    border-bottom: 1px solid #f0fdf4;
}

.budget-row:last-child {
    border-bottom: none;
}

.budget-row:hover {
    background-color: #f0fdf4;
}

/* Form elements */
.input-cell {
    padding: 0.125rem;
}

.input-cell input {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.input-cell input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 1px #22c55e;
}

/* Custom item button */
.custom-items-container {
    padding: 0.5rem 1rem;
    border-top: 1px solid #f0fdf4;
}

.add-custom-btn {
    display: flex;
    align-items: center;
    color: white;
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    background: #22c55e; /* Solid green */
    border: 1px solid #22c55e;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.add-custom-btn:hover {
    background-color: #16a34a; /* Darker green on hover */
}

.icon-plus {
    width: 1rem;
    height: 1rem;
    margin-right: 0.25rem;
}

/* Overview panel */
.overview-panel {
    background-color: white;
    border-radius: 0.5rem;
    padding: 1.25rem;
    position: sticky;
    top: 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--accent-color);
}

.overview-title {
    font-size: 1rem;
    font-weight: 600;
    color: #15803d;
    margin-bottom: 1rem;
    margin-top: 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0fdf4;
}

.overview-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.overview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    background-color: #f8fafc;
}

.overview-income {
    background-color: #f0fdf4;
    color: #15803d;
}

.overview-income .amount {
    color: #16a34a;
    font-weight: 600;
}

.overview-expenses {
    background-color: #fef2f2;
    color: #dc2626;
}

.overview-expenses .amount {
    color: #dc2626;
    font-weight: 600;
}

.overview-savings {
    background-color: #f0f9ff;
    color: #2563eb;
}

.overview-savings .amount {
    color: #0369a1;
    font-weight: 600;
}

.overview-divider {
    height: 2px;
    background-color: #f0fdf4;
    margin: 0.25rem 0;
}

.overview-result {
    font-weight: 600;
    background-color: #f8fafc;
}

.overview-result.positive {
    background-color: #f0fdf4;
    color: #15803d;
}

.overview-result.positive .amount {
    color: #16a34a;
}

.overview-result.negative {
    background-color: #fef2f2;
    color: #dc2626;
}

.overview-result.negative .amount {
    color: #dc2626;
}

/* Responsive layout adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }

    .main-content {
        flex-direction: column;
    }

    .content-right {
        width: 100%;
        margin-top: 1rem;
    }

    .tabs-container {
        flex-wrap: wrap;
    }

    .tab {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: calc(50% - 0.25rem);
    }

    .grid-header {
        grid-template-columns: 1fr;
    }

    .budget-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .col-span-4 {
        grid-column: span 1;
    }

    /* Results page specific mobile styles */
    .excel-results {
        margin: 0 -0.5rem;
        padding: 0.5rem;
    }

    .excel-table {
        border-radius: 0.5rem;
        overflow: hidden;
    }

    .download-btn {
        width: 100%;
        text-align: center;
        margin-top: 1rem;
    }

    .overview-panel {
        position: static;
        margin-top: 1rem;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
    }

    .container {
        max-width: none;
        padding: 0;
    }

    .language-select,
    .tabs-container,
    .download-btn {
        display: none;
    }

    .excel-results {
        font-size: 11pt;
    }

    .excel-table {
        border: 1px solid #000;
    }

    .excel-row {
        page-break-inside: avoid;
    }

    .excel-cell {
        border-color: #000;
    }

    .excel-row.header,
    .excel-row.tab-header {
        background-color: #f8f8f8 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Updated color palette for a modern & colorful look */
:root {
    --primary-color: #005f73;      /* Deep teal for professionalism */
    --primary-light: #0a9396;      /* Brighter teal */
    --secondary-color: #94d2bd;    /* Soft complementary tone */
    --secondary-light: #e9d8a6;    /* Warm light accent */
    --accent-color: #ee9b00;       /* Vibrant tangerine for accents */
    --background-gradient: linear-gradient(0deg, #fbf5f3, #fff);
    --primary-gradient: linear-gradient(to right, #22c55e, #14b8a6);
    --primary-hover-gradient: linear-gradient(to right, #16a34a, #0d9488);
    --text-accent: #6b21a8;
}

.excel-results {
    font-size: 0.875rem;
    line-height: 1.25rem;
    width: 100%;
    overflow-x: auto;
    background-color: #f0f9ff; /* soft blue background */
}
.excel-table {
    border: 1px solid #cbd5e1;
    border-collapse: collapse;
    width: 100%;
}
.excel-row {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(100px, auto); /* Changed to 2 columns */
    border-bottom: 1px solid #cbd5e1;
}
.excel-cell {
    padding: 0.75rem;
    border-right: 1px solid #cbd5e1;
}

.excel-cell:last-child {
    border-right: none;
}

.excel-cell.indent {
    padding-left: 2rem; /* Increased indent for better hierarchy */
}

.excel-row.header {
    background-color: #bae6fd;
    font-weight: 600;
}
.excel-row.tab-header {
    background-color: #e0f2fe;
    font-weight: 600;
    font-size: 1rem;
}
.excel-row.category {
    background-color: #f0faff;
    font-weight: 500;
}
.excel-cell.indent {
    padding-left: 1.5rem;
}
.excel-row.total {
    background-color: #bae6fd;
    font-weight: 600;
}
.excel-row.final-result {
    font-weight: 700;
    background-color: transparent !important; /* Force no background */
    border-top: 2px solid #e5e7eb;
}

.excel-row.final-result .excel-cell {
    background-color: transparent !important; /* Force no background on cells */
}

.excel-row.final-result.positive .excel-cell:last-child {
    color: #059669;
    background-color: transparent !important;
}

.excel-row.final-result.negative .excel-cell:last-child {
    color: #dc2626;
    background-color: transparent !important;
}

.download-btn {
    display: inline-block;
    background-color: #354cda; /* Solid blue */
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: background-color 0.2s;
}

.download-btn:hover {
    background-color: #2e42bd; /* Darker blue on hover */
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .excel-row {
        grid-template-columns: minmax(150px, 2fr) minmax(80px, 1fr);
    }
    .excel-cell {
        padding: 0.5rem;
    }
    
    .excel-cell.indent {
        padding-left: 1.5rem;
    }
}

.amount-input:focus {
    border-color: #22c55e;
    outline: none;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.overview-item {
    @apply bg-white rounded-lg shadow-md p-4 mb-4;
}

.final-result.positive {
    color: #15803d;
}

.final-result.negative {
    color: #dc2626;
}