/* CSS Variables */
:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d24;
    --bg-card: #22262f;
    --bg-hover: #2a2f3a;
    --text-primary: #f0f2f5;
    --text-secondary: #a0a6b1;
    --text-muted: #6b7280;
    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-green: #22c55e;
    --accent-yellow: #eab308;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition-fast: 150ms ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.app {
    max-width: 500px;
    margin: 0 auto;
    padding: 24px;
}

.back-link {
    display: inline-block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 24px;
    transition: var(--transition-fast);
}
.back-link:hover { color: var(--accent-primary); }

.header { text-align: center; margin-bottom: 32px; }
.title { font-size: 2rem; font-weight: 700; margin-bottom: 8px; }
.subtitle { color: var(--text-secondary); }

.calculator {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 32px;
}

.input-section { margin-bottom: 24px; }

.input-group { margin-bottom: 20px; }
.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-wrapper.currency .prefix {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 1.1rem;
}
.input-wrapper.currency input { padding-left: 32px; }
.input-wrapper.percent .suffix {
    position: absolute;
    right: 16px;
    color: var(--text-muted);
}
.input-wrapper.percent input { padding-right: 32px; }

input[type="number"] {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.1rem;
    transition: var(--transition-fast);
}
input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Tip Buttons */
.tip-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.tip-btn {
    flex: 1;
    min-width: 60px;
    padding: 12px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}
.tip-btn:hover { border-color: var(--accent-primary); }
.tip-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.custom-tip {
    display: flex;
    align-items: center;
    gap: 12px;
}
.custom-tip label {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    margin-bottom: 0;
}
.custom-tip .input-wrapper { flex: 1; }
.custom-tip input { padding: 10px 32px 10px 12px; }

/* Split Control */
.split-control {
    display: flex;
    align-items: center;
    gap: 12px;
}
.split-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-hover);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}
.split-btn:hover { border-color: var(--accent-primary); }
.split-control input {
    width: 60px;
    text-align: center;
    padding: 10px;
}
.split-label { color: var(--text-muted); }

/* Results */
.results-section {
    display: grid;
    gap: 12px;
}
.result-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}
.result-card.highlight {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #1d4ed8 100%);
}
.result-label { color: var(--text-secondary); font-weight: 500; }
.result-card.highlight .result-label { color: rgba(255,255,255,0.8); }
.result-value { font-size: 1.25rem; font-weight: 700; color: var(--accent-green); }
.result-value.large { font-size: 1.5rem; }
.result-card.highlight .result-value { color: white; }
#perPersonCard { display: none; }
#perPersonCard.visible { display: flex; }

/* Quick Tips */
.quick-tips {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--bg-hover);
}
.quick-tips h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.tips-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.tip-ref {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    text-align: center;
}
.tip-ref .service { font-size: 0.75rem; color: var(--text-muted); }
.tip-ref .amount { font-size: 0.85rem; font-weight: 600; color: var(--accent-green); }

/* FAQ */
.faq-section { margin-bottom: 32px; }
.faq-title { font-size: 1.25rem; margin-bottom: 16px; }
.faq-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    overflow: hidden;
}
.faq-question {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question:hover { background: var(--bg-hover); }
.faq-answer { padding: 0 16px 16px; color: var(--text-secondary); }
.faq-answer ul { margin-left: 20px; margin-top: 8px; }
.faq-answer li { margin-bottom: 4px; }

/* Footer */
.footer { text-align: center; color: var(--text-muted); font-size: 0.85rem; }
.related-tools { margin-top: 8px; }
.related-tools a { color: var(--accent-primary); text-decoration: none; }
.related-tools a:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .tips-grid { grid-template-columns: repeat(2, 1fr); }
    .tip-buttons { gap: 6px; }
    .tip-btn { min-width: 50px; padding: 10px 6px; font-size: 0.9rem; }
}
