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

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --background-color: #f7f7f7;
    --surface-color: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --success-color: #48bb78;
    --error-color: #f56565;
    --border-radius: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #B0E0E6 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Language Switcher */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
}

.language-switcher select {
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.language-switcher select:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
}

.language-switcher select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    border-color: white;
}

.language-switcher select option {
    background: var(--primary-color);
    color: white;
}

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 20px 0;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header .subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Category Selector */
.category-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.category-btn {
    padding: 10px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
}

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

/* Main Content */
.main-content {
    flex: 1;
}

/* Converter Section */
.converter-section {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.converter-box {
    margin-bottom: 30px;
}

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

.input-group label,
.unit-select label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.unit-group {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.unit-select {
    flex: 1;
}

.unit-select select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    cursor: pointer;
    background: white;
    transition: var(--transition);
}

.unit-select select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.swap-btn {
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.swap-btn:hover {
    background: var(--background-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Result Box */
.result-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
}

.result-display {
    flex: 1;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.result-unit {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.copy-btn {
    padding: 10px 16px;
    margin-left: 16px;
    border: 2px solid var(--primary-color);
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.copy-btn:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

.copy-btn.copied {
    background: var(--success-color);
    border-color: var(--success-color);
}

/* Currency Update Note */
.currency-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 6px;
    font-style: italic;
}

/* History Section */
.history-section {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.history-section h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.history-item {
    padding: 12px;
    background: var(--background-color);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:hover {
    background: #e2e8f0;
}

.history-item-text {
    color: var(--text-primary);
}

.history-item-time {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.empty-state {
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
}

.clear-history-btn {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.clear-history-btn:hover {
    background: var(--background-color);
    color: var(--text-primary);
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    font-size: 0.9rem;
    opacity: 0.8;
    padding: 20px 0;
}

/* Responsive */
@media (max-width: 600px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .category-selector {
        gap: 8px;
    }

    .category-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .converter-section {
        padding: 20px;
    }

    .unit-group {
        gap: 8px;
    }

    .result-box {
        flex-direction: column;
        align-items: flex-start;
    }

    .copy-btn {
        margin-left: 0;
        margin-top: 12px;
        width: 100%;
    }

    .result-value {
        font-size: 1.5rem;
    }

    /* Adjust tip jar for mobile */
    .tip-jar-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .tip-jar-content {
        width: 280px !important;
    }
}

/* Scrollbar */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #cbd5e0;
}

/* Tip Jar (Fixed Position) */
.tip-jar {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    font-family: var(--font-primary);
}

.tip-jar-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    background: white;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.tip-jar-toggle:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.tip-jar-toggle:active {
    transform: scale(0.95);
}

.tip-jar-content {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow), 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 20px;
    animation: slideUp 0.3s ease-out;
    border: 1px solid var(--border-color);
}

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

.tip-jar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.tip-jar-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.tip-jar-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tip-jar-close:hover {
    color: var(--primary-color);
    transform: rotate(90deg);
}

.tip-jar-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    text-align: center;
}

.tip-jar-qr {
    text-align: center;
    margin: 12px 0;
    padding: 12px;
    background: var(--background-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    max-height: 200px;
}

.qr-img {
    max-width: 100%;
    max-height: 180px;
    width: auto;
    height: auto;
    border-radius: 6px;
    object-fit: scale-down;
}

.tip-jar-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 8px 0;
    text-align: center;
}

.support-link {
    display: inline-block;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    background: #ffdd00;
    color: #111;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    text-align: center;
    transition: var(--transition);
    font-size: 0.9rem;
    border: none;
}

.support-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Mobile adjustments for tip jar */
@media (max-width: 600px) {
    .tip-jar {
        bottom: 20px;
        right: 20px;
    }

    .tip-jar-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .tip-jar-content {
        width: 280px;
        padding: 16px;
    }
}

/* Share Buttons */
.share-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.share-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.share-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .share-buttons {
        gap: 0.75rem;
    }

    .share-btn {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }
}
