* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(to bottom, 
        #FFFFFF 0%, 
        #FFFFFF 33.33%, 
        #00966E 33.33%, 
        #00966E 66.66%, 
        #D62612 66.66%, 
        #D62612 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    transition: background 0.6s ease, color 0.6s ease;
}

body.dark-mode {
    background: linear-gradient(to bottom, 
        #484848 0%, 
        #565656 33.33%, 
        #004d3a 33.33%, 
        #004d3a 66.66%, 
        #8b1810 66.66%, 
        #8b1810 100%);
    color: #e0e0e0;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 10px;
    transition: background 0.6s ease, box-shadow 0.6s ease;
}

body.dark-mode .container {
    background: #2d2d2d;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.header-with-lang {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.header-content {
    flex: 1;
}

.header-buttons {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.dark-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dark-mode-toggle:hover {
    transform: translateY(-2px) rotate(15deg);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

body.dark-mode .dark-mode-toggle {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
}

body.dark-mode .dark-mode-toggle .dark-mode-icon::before {
    content: '☀️';
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.lang-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.lang-toggle .flag {
    font-size: 1.3rem;
}

.lang-toggle .lang-text {
    font-weight: 700;
}

h1 {
    text-align: center;
    color: #667eea;
    font-size: 2.5rem;
    margin-bottom: 5px;
    transition: color 0.6s ease;
}

body.dark-mode h1 {
    color: #8b9eff;
}

.subtitle {
    text-align: center;
    color: #888;
    font-size: 1rem;
    margin-bottom: 30px;
    transition: color 0.6s ease;
}

body.dark-mode .subtitle {
    color: #aaa;
}

h2 {
    color: #667eea;
    font-size: 1.5rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
    transition: color 0.6s ease, border-color 0.6s ease;
}

body.dark-mode h2 {
    color: #8b9eff;
    border-bottom-color: #8b9eff;
}

h3 {
    color: #764ba2;
    font-size: 1.2rem;
    margin-bottom: 15px;
    transition: color 0.6s ease;
}

body.dark-mode h3 {
    color: #9d6cc9;
}

/* Items Section */
.items-section {
    margin-bottom: 30px;
}

.item-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.autocomplete-wrapper {
    flex: 2;
    min-width: 150px;
    position: relative;
}

.item-name-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: background 0.6s ease, border-color 0.6s ease, color 0.6s ease;
}

body.dark-mode .item-name-input {
    background: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body.dark-mode .autocomplete-dropdown {
    background: #3d3d3d;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s ease;
}

body.dark-mode .autocomplete-item {
    border-bottom-color: #555;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: #f0f0f0;
}

body.dark-mode .autocomplete-item:hover,
body.dark-mode .autocomplete-item.active {
    background: #4d4d4d;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.item-price-input {
    flex: 1;
    min-width: 100px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: background 0.6s ease, border-color 0.6s ease, color 0.6s ease;
}

body.dark-mode .item-price-input {
    background: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}

.currency-select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: background 0.6s ease, border-color 0.6s ease, color 0.6s ease;
}

body.dark-mode .currency-select {
    background: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}

.btn-primary {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    width: 100%;
    padding: 12px 24px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 15px;
}

.btn-secondary:hover {
    background: #ee5a52;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.items-list {
    margin-bottom: 20px;
    min-height: 50px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s, background 0.6s ease;
}

.item-row:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

body.dark-mode .item-row {
    background: #3d3d3d;
}

body.dark-mode .item-row:hover {
    background: #4a4a4a;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    transition: color 0.6s ease;
}

body.dark-mode .item-name {
    color: #e0e0e0;
}

.item-prices {
    font-size: 0.9rem;
    color: #666;
    transition: color 0.6s ease;
}

body.dark-mode .item-prices {
    color: #aaa;
}

.delete-btn {
    padding: 6px 12px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.delete-btn:hover {
    background: #ee5a52;
}

.totals {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.total-row:last-child {
    margin-bottom: 0;
}

.total-value {
    font-size: 1.4rem;
}

/* Payment Section */
.payment-section {
    margin-top: 20px;
}

.payment-display {
    margin-bottom: 20px;
}

.payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.payment-row label {
    font-weight: 600;
    color: #333;
    transition: color 0.6s ease;
}

body.dark-mode .payment-row label {
    color: #e0e0e0;
}

.payment-input {
    padding: 10px;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: right;
    background: white;
    color: #667eea;
    min-width: 150px;
    transition: background 0.6s ease, border-color 0.6s ease, color 0.6s ease;
}

body.dark-mode .payment-input {
    background: #2d2d2d;
    border-color: #8b9eff;
    color: #8b9eff;
}

/* Currency Switch */
.currency-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: #666;
}

.tab-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.tab-btn:hover:not(.active) {
    background: #e9ecef;
}

/* Bills Panel */
.bills-panel {
    display: none;
}

.bills-panel.active {
    display: block;
}

.bills-coins-container {
    display: flex;
    gap: 20px;
}

.bills-column,
.coins-column {
    flex: 1;
}

.bills-column h4,
.coins-column h4 {
    color: #555;
    font-size: 1rem;
    margin-bottom: 12px;
    text-align: center;
    transition: color 0.6s ease;
}

body.dark-mode .bills-column h4,
body.dark-mode .coins-column h4 {
    color: #aaa;
}

.bills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.coins-column .bills-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
}

.bill-btn {
    padding: 15px 10px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.bill-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.bill-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.bill-btn.coin {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    border-radius: 50%;
    aspect-ratio: 1 / 1;
    padding: 10px;
    font-size: 0.85rem;
}

/* Change Display */
.change-display {
    background: white;
    padding: 10px;
    border-radius: 8px;
    margin-top: 15px;
    border: 2px solid #4CAF50;
    transition: background 0.6s ease, border-color 0.6s ease;
}

body.dark-mode .change-display {
    background: #2d2d2d;
    border-color: #66bb6a;
}

.change-display h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1rem;
    text-align: center;
}

.change-values-container {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.change-value-box {
    background: #f5f5f5;
    padding: 20px 30px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.6s ease, border-color 0.6s ease;
}

body.dark-mode .change-value-box {
    background: #1a1a1a;
    border-color: #404040;
}

.change-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4CAF50;
    transition: color 0.6s ease;
}

body.dark-mode .change-value {
    color: #66bb6a;
}

/* Change Given Section */
.change-given-section {
    margin-top: 20px;
}

.change-given-section h3 {
    color: #FF9800;
    margin-top: 0;
    border-bottom: 2px solid #FF9800;
    padding-bottom: 10px;
    margin-bottom: 15px;
    transition: color 0.6s ease, border-color 0.6s ease;
}

body.dark-mode .change-given-section h3 {
    color: #ffb84d;
    border-bottom-color: #ffb84d;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    
    .header-with-lang {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .header-buttons {
        order: -1;
    }

    h1 {
        font-size: 2rem;
    }

    .item-input-group {
        flex-direction: column;
    }

    .item-name-input,
    .item-price-input {
        width: 100%;
    }

    .bills-coins-container {
        flex-direction: column;
        gap: 15px;
    }

    .bills-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .coins-column .bills-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }

    .bill-btn {
        padding: 12px 8px;
        font-size: 0.9rem;
    }
    
    .bill-btn.coin {
        padding: 8px;
        font-size: 0.75rem;
    }
}
