:root {
    --primary-color: #2e7d32;
    --primary-light: #e8f5e9;
    --text-dark: #1a1a1a;
    --text-gray: #666666;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --danger: #d32f2f;
    --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.5;
    height: 100vh;
    display: flex;
}

.app-container {
    width: 100%;
    max-width: 480px;
    background-color: var(--bg-color);
    padding: 20px;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0 auto;
    transition: max-width 0.3s ease;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
}

.app-selector {
    display: flex;
    background: #e0e0e0;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.nav-btn {
    border: none;
    background: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-gray);
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn.active {
    background: #ffffff;
    color: var(--primary-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
    padding: 5px;
}

.danger-icon {
    color: var(--danger);
}

.danger-icon:hover {
    background: #ffebee;
    border-radius: 6px;
}

h1,
h2 {
    color: var(--text-dark);
}

h2 {
    font-size: 1.1rem;
    color: var(--text-gray);
    margin-bottom: 12px;
    font-weight: 600;
}

.summary-card,
.control-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.balance-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.label {
    font-size: 0.9rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.amount-display {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
}

.currency {
    font-size: 1.5rem;
    margin-top: 8px;
    margin-right: 4px;
    color: var(--text-gray);
}

.budget-info {
    border-top: 1px solid var(--bg-color);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
}

.budget-info .row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    color: var(--text-gray);
}

.budget-edit {
    display: flex;
    gap: 8px;
}

.search-section {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-section .search-bar {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-gray);
    pointer-events: none;
}

#searchInput {
    padding-left: 40px;
}

.badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 6px;
}

input,
select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid transparent;
    background-color: #fff;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

button {
    font-family: inherit;
}

#addEntryBtn,
#addItemBtn,
#saveBudgetBtn,
.danger-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0 24px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.danger-btn {
    background-color: var(--danger) !important;
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    align-self: flex-end;
}

.hidden {
    display: none !important;
}

ul {
    list-style: none;
    padding: 0;
}

.entry-item {
    background: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
    animation: slideIn 0.3s ease-out;
}

.entry-info h3 {
    font-size: 1rem;
    font-weight: 500;
}

.entry-info p {
    font-size: 0.8rem;
    color: var(--text-gray);
}

.entry-actions {
    display: flex;
    align-items: center;
    gap: 0;
}

.amount {
    font-weight: 600;
    color: var(--danger);
}

.delete-btn,
.action-btn {
    background: none;
    border: none;
    color: #bdbdbd;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.delete-btn:hover,
.action-btn.btn-delete:hover {
    color: var(--danger);
    background: #ffebee;
}

.action-btn.btn-plus:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

.action-btn.btn-minus:hover {
    color: #ef6c00;
    background: #fff3e0;
}

.pantry-qty-display {
    display: none;
}

.left-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.add-entry-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group.row {
    display: flex;
    gap: 12px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-container.wide-mode {
    max-width: 1400px;
    display: grid;
    grid-template-columns: 350px 1fr 1fr;
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: 24px;
    flex-shrink: 0;
}

.app-container.wide-mode.view-budget {
    max-width: 900px;
    min-width: 850px;
    width: 100%;
    grid-template-columns: 350px 1fr;
}

.app-container.wide-mode.view-pantry {
    grid-template-columns: 350px 1fr;
    min-width: 1200px;
}

.app-container.wide-mode header {
    grid-column: 1 / -1;
}

.app-container.wide-mode .view-section {
    display: contents;
}

.app-container.wide-mode #budgetView.hidden,
.app-container.wide-mode #pantryView.hidden {
    display: none;
}

.app-container.wide-mode #budgetView .left-group {
    grid-column: 1;
    grid-row: 2;
}

.app-container.wide-mode #budgetView .transactions-list {
    grid-column: 2;
    grid-row: 2;
}

.app-container.wide-mode #pantryView .control-card {
    grid-column: 1;
    grid-row: 2;
    margin-bottom: 24px;
}

.app-container.wide-mode .lists-wrapper {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

#freezerSection {
    margin-bottom: 40px;
}

#pantryView .control-card {
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .app-container.wide-mode.view-pantry {
        min-width: 750px;
    }

    .app-container.wide-mode .lists-wrapper {
        grid-template-columns: 1fr;
    }
}