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

:root {
    --primary-color: #4F46E5;
    --primary-dark: #4338CA;
    --secondary-color: #10B981;
    --background: #F9FAFB;
    --surface: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-lg);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.logo-icon {
    font-size: 36px;
}

.lang-switcher {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.lang-btn {
    padding: 8px 16px;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.lang-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

main {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

.mode-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.mode-btn {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
}

.mode-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-color: var(--primary-color);
}

.mode-icon {
    font-size: 20px;
}

.calc-section {
    animation: fadeIn 0.3s ease;
}

.calc-section.hidden {
    display: none;
}

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

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 15px;
    font-size: 18px;
    color: var(--text-secondary);
}

.input-wrapper input {
    width: 100%;
    padding: 12px 12px 12px 35px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 18px;
    transition: all 0.3s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.tip-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr) 1.5fr;
    gap: 10px;
}

.tip-btn {
    padding: 12px;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tip-btn:hover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.tip-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#customTip {
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    transition: all 0.3s ease;
}

#customTip:focus {
    outline: none;
    border-color: var(--primary-color);
}

.people-counter {
    display: flex;
    align-items: center;
    gap: 15px;
}

.counter-btn {
    width: 45px;
    height: 45px;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.counter-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

#numPeople {
    width: 80px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 18px;
    text-align: center;
    font-weight: 600;
}

.tip-guide {
    background: linear-gradient(135deg, #F3F4F6, #E5E7EB);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 25px;
}

.tip-guide h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 18px;
}

#countrySelect {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    background: var(--surface);
    cursor: pointer;
    margin-bottom: 15px;
}

.tip-info {
    padding: 15px;
    background: var(--surface);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
    display: none;
    animation: slideIn 0.3s ease;
}

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

.result-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: var(--radius);
    padding: 25px;
    color: white;
    margin-top: 30px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.result-item:last-child {
    border-bottom: none;
}

.result-item.highlight {
    padding-top: 20px;
    margin-top: 10px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.result-value {
    font-size: 24px;
    font-weight: 700;
}

.result-value.large {
    font-size: 32px;
}

.person-card {
    background: var(--background);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 15px;
    position: relative;
    border: 2px solid var(--border);
}

.remove-person-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    background: #EF4444;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.person-name {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 15px;
}

.order-items {
    margin-bottom: 15px;
}

.order-item, .shared-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.item-name {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.item-price {
    width: 100px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.remove-item-btn {
    padding: 6px 12px;
    background: #EF4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.add-item-btn, .add-person-btn, .add-shared-btn {
    padding: 10px 20px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.add-item-btn:hover, .add-person-btn:hover, .add-shared-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

.person-total {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 16px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--border);
}

.shared-items {
    background: #FEF3C7;
    border-radius: var(--radius);
    padding: 20px;
    margin: 20px 0;
}

.shared-items h3 {
    margin-bottom: 15px;
    color: #92400E;
}

.detail-result {
    background: var(--background);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 20px;
}

.tip-setting {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-weight: 600;
}

#detailTipPercent {
    width: 80px;
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: 6px;
}

.person-summary {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.total-summary {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}

.grand-total {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 10px;
}

.share-section {
    margin-top: 30px;
    text-align: center;
}

.share-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.qr-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    padding: 20px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.qr-container.hidden {
    display: none;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: white;
    font-size: 14px;
}

@media (max-width: 640px) {
    .container {
        padding: 10px;
    }
    
    main {
        padding: 20px;
    }
    
    .tip-selector {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .mode-selector {
        flex-direction: column;
    }
    
    .lang-switcher {
        flex-wrap: wrap;
    }
    
    .result-value.large {
        font-size: 24px;
    }
}