/* =============================================
   Tping — Premium Tipping Prototype
   Design: Dark mode + Gold (#D4AF37)
   Font: Plus Jakarta Sans
   ============================================= */

:root {
    --gold: #D4AF37;
    --gold-light: #F5D77A;
    --gold-dark: #B8962E;
    --gold-glow: rgba(212, 175, 55, 0.25);
    --gold-glow-strong: rgba(212, 175, 55, 0.45);

    --bg-primary: #0A0A0B;
    --bg-card: #141416;
    --bg-card-elevated: #1C1C1F;
    --bg-glass: rgba(28, 28, 31, 0.75);
    --bg-glass-heavy: rgba(20, 20, 22, 0.92);
    --bg-input: #1C1C1F;

    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-tertiary: rgba(255, 255, 255, 0.35);
    --text-gold: #D4AF37;

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-gold: rgba(212, 175, 55, 0.3);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    --shadow-card: 0 2px 20px rgba(0, 0, 0, 0.3);
    --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 4px 30px rgba(212, 175, 55, 0.2);

    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

    --sheet-height: 440px;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =============================================
   SCREEN
   ============================================= */
.screen {
    display: none;
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
    align-items: center;
    padding-bottom: 40px;
}
.screen.active {
    display: flex;
}

/* =============================================
   STATUS BAR SPACER
   ============================================= */
.status-bar-spacer {
    height: env(safe-area-inset-top, 12px);
    min-height: 12px;
    width: 100%;
}

/* =============================================
   APP HEADER
   ============================================= */
.app-header {
    width: 100%;
    max-width: 420px;
    padding: 16px 24px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: #0A0A0B;
}

.logo-text {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

/* =============================================
   PROFILE CONTENT
   ============================================= */
.profile-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 420px;
    padding: 20px 24px 0;
}

/* Photo */
.profile-photo-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.profile-photo-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 2;
}

.photo-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    opacity: 0.4;
    z-index: 1;
}

.online-indicator {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: #22C55E;
    border-radius: 50%;
    border: 3px solid var(--bg-primary);
    z-index: 3;
}

/* Name */
.profile-name {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.profile-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--gold);
    margin-bottom: 2px;
}

.profile-workplace {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Stars */
.star-rating {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.star {
    font-size: 18px;
    color: var(--text-tertiary);
    transition: color 0.3s ease;
}

.star.filled {
    color: var(--gold);
}

/* Tagline */
.profile-tagline {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 36px;
    text-align: center;
    line-height: 1.5;
}

/* =============================================
   SEND A TIP BUTTON
   ============================================= */
.tip-cta-btn {
    width: 100%;
    max-width: 320px;
    height: 58px;
    background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 50%, var(--gold-light) 100%);
    border: none;
    border-radius: var(--radius-xl);
    color: #0A0A0B;
    font-family: var(--font);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-gold);
}

.tip-cta-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 15px rgba(212, 175, 55, 0.3);
}

.tip-cta-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 50%);
    border-radius: inherit;
    pointer-events: none;
}

.cta-icon {
    display: flex;
    align-items: center;
}

/* =============================================
   SUPPORTERS SECTION
   ============================================= */
.supporters-section {
    width: 100%;
    max-width: 320px;
    margin-top: 40px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeSupporters 0.6s ease 0.3s forwards;
}

@keyframes fadeSupporters {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.supporters-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 12px;
}

.supporters-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.supporter-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: transform 0.15s ease, background 0.15s ease;
}

.supporter-card:active {
    transform: scale(0.98);
    background: var(--bg-card-elevated);
}

.supporter-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 14px;
    color: #0A0A0B;
}

.supporter-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.supporter-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.supporter-time {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-tertiary);
}

.supporter-amount {
    font-size: 15px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: -0.2px;
}

/* =============================================
   OVERLAY
   ============================================= */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 90;
    pointer-events: none;
    transition: background 0.35s ease;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
}

.overlay.visible {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* =============================================
   BOTTOM SHEET
   ============================================= */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-glass-heavy);
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    border-top: 1px solid var(--border-light);
    backdrop-filter: blur(40px) saturate(1.5);
    -webkit-backdrop-filter: blur(40px) saturate(1.5);
    padding: 0 24px 34px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    max-width: 480px;
    margin: 0 auto;
    max-height: 90vh;
    overflow-y: auto;
}

.bottom-sheet.open {
    transform: translateY(0);
}

.sheet-handle-container {
    display: flex;
    justify-content: center;
    padding: 12px 0 8px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.sheet-handle {
    width: 36px;
    height: 5px;
    background: var(--text-tertiary);
    border-radius: var(--radius-full);
    opacity: 0.5;
}

/* Sheet header */
.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.sheet-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sheet-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.sheet-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.sheet-subtitle {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
}

.sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
}

.sheet-close:active {
    transform: scale(0.9);
    background: var(--border-light);
}

/* Quick amounts */
.quick-amounts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.amount-chip {
    height: 52px;
    border-radius: var(--radius-md);
    background: var(--bg-card-elevated);
    border: 1.5px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.amount-chip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(212,175,55,0.15), rgba(212,175,55,0.05));
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: inherit;
}

.amount-chip:active {
    transform: scale(0.95);
}

.amount-chip.selected {
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 20px var(--gold-glow), inset 0 0 20px rgba(212,175,55,0.06);
}

.amount-chip.selected::before {
    opacity: 1;
}

/* Divider */
.section-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

.section-divider span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Custom amount */
.custom-amount-wrapper {
    margin-bottom: 16px;
}

.custom-amount-input-container {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0 16px;
    height: 52px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.custom-amount-input-container.focused {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.currency-symbol {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-right: 8px;
}

.custom-amount-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    width: 100%;
}

.custom-amount-input::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
    font-size: 16px;
}

.custom-amount-input::-webkit-outer-spin-button,
.custom-amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.custom-amount-input[type=number] {
    -moz-appearance: textfield;
}

/* Message */
.message-wrapper {
    margin-bottom: 24px;
}

.message-input {
    width: 100%;
    background: var(--bg-input);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 400;
    color: var(--text-primary);
    resize: none;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    line-height: 1.5;
}

.message-input::placeholder {
    color: var(--text-tertiary);
}

.message-input:focus {
    border-color: rgba(255,255,255,0.15);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.04);
}

/* Tip submit button */
.tip-submit-btn {
    width: 100%;
    height: 56px;
    background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 50%, var(--gold-light) 100%);
    border: none;
    border-radius: var(--radius-lg);
    color: #0A0A0B;
    font-family: var(--font);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: var(--shadow-gold);
}

.tip-submit-btn:active {
    transform: scale(0.97);
}

.tip-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.tip-submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 50%);
    border-radius: inherit;
    pointer-events: none;
}

.btn-loader {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: absolute;
    inset: 0;
}

.btn-loader.visible {
    display: flex;
}

.btn-text.hidden {
    visibility: hidden;
}

.loader-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0A0A0B;
    animation: dotPulse 1.2s ease-in-out infinite;
}

.loader-dot:nth-child(2) { animation-delay: 0.15s; }
.loader-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* =============================================
   SUCCESS OVERLAY
   ============================================= */
.success-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: background 0.4s ease, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease;
}

.success-overlay.visible {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    pointer-events: auto;
}

.success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px;
    max-width: 340px;
    opacity: 0;
    transform: scale(0.85) translateY(20px);
    transition: all 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

.success-overlay.visible .success-content {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Success icon */
.success-icon-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 28px;
}

.success-ring {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    opacity: 0;
    transform: scale(0.5);
}

.success-ring.animate {
    animation: ringExpand 0.6s cubic-bezier(0.32, 0.72, 0, 1) 0.1s forwards;
}

@keyframes ringExpand {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 0.5; }
    100% { opacity: 0; transform: scale(1.6); }
}

.success-check {
    width: 100px;
    height: 100px;
}

.check-path {
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
}

.check-path.animate {
    animation: drawCheck 0.5s ease 0.3s forwards;
}

@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}

.success-check circle {
    stroke-dasharray: 150;
    stroke-dashoffset: 150;
}

.success-check circle.animate {
    animation: drawCircle 0.6s ease 0.1s forwards;
}

@keyframes drawCircle {
    to { stroke-dashoffset: 0; }
}

/* Confetti canvas */
#confettiCanvas {
    position: fixed;
    inset: 0;
    z-index: 201;
    pointer-events: none;
}

/* Success text */
.success-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    line-height: 1.3;
}

.success-subtitle {
    font-size: 15px;
    font-weight: 500;
    color: var(--gold);
    margin-bottom: 4px;
}

.success-thankyou {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 36px;
    line-height: 1.5;
}

/* Done button */
.done-btn {
    width: 100%;
    max-width: 240px;
    height: 52px;
    background: var(--bg-card-elevated);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.done-btn:active {
    transform: scale(0.96);
    background: var(--border-light);
}

/* =============================================
   UTILITY ANIMATIONS
   ============================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Safe area padding for bottom */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-sheet {
        padding-bottom: calc(34px + env(safe-area-inset-bottom));
    }
}