/* Design-System und CSS-Variablen */
:root {
    --bg-gradient-start: #0b0f19;
    --bg-gradient-end: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-emerald: #10b981;
    --accent-emerald-glow: rgba(16, 185, 129, 0.15);
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Euro-Schein- und Münz-Farben */
    --color-0-1: #d97706;  /* Kupfer/Bronze (10 Cent) */
    --color-0-2: #b45309;  /* Kupfer dunkel (20 Cent) */
    --color-0-5: #d4a017;  /* Gold (50 Cent) */
    --color-1: #ca8a04;    /* Gold/Ocker (1€) */
    --color-2: #94a3b8;    /* Silber/Grau (2€) */
    --color-5: #6b7280;   /* Grau */
    --color-10: #ef4444;  /* Rot */
    --color-20: #3b82f6;  /* Blau */
    --color-50: #f97316;  /* Orange */
    --color-100: #10b981; /* Grün */
    --color-200: #eab308; /* Gelb-Ocker */
}

/* Globale Stile */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    background-attachment: fixed;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    line-height: 1.5;
}

/* App-Container – fixiert, damit der Browser ihn nie verschieben kann */
.app-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 600px;
    margin: 0 auto;
    padding: 1.25rem 1.25rem 0.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
    animation: fadeIn 0.8s ease;
}

.greeting-container {
    display: flex;
    flex-direction: column;
}

.greeting-time {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-heading);
}

.greeting-name {
    font-family: var(--font-heading);
    font-size: clamp(1.375rem, 6vw, 1.625rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.125rem;
}

.date-container {
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(30, 41, 59, 0.4);
    padding: 0.375rem 0.75rem;
    border-radius: 99px;
    border: 1px solid var(--card-border);
}

/* Summenanzeige-Sektion */
.total-section {
    margin-bottom: 1rem;
    animation: slideDown 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.total-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(30, 41, 59, 0.85));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 1.75rem;
    text-align: center;
    box-shadow: var(--card-shadow), 0 0 40px var(--accent-emerald-glow);
    position: relative;
    overflow: hidden;
}

.total-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-emerald), transparent);
}

.total-label {
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-emerald);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.total-amount-wrapper {
    display: flex;
    justify-content: center;
    align-items: baseline;
    margin: 0.75rem 0;
}

.total-amount {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 10vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1;
}

.total-currency {
    font-family: var(--font-heading);
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    font-weight: 700;
    color: var(--accent-emerald);
    margin-left: 0.375rem;
}

.total-stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Schein-Liste */
.denominations-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.625rem;
    margin-bottom: 1.25rem;
    animation: fadeIn 1s ease 0.2s both;
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar-Design für die Liste */
.denominations-container::-webkit-scrollbar {
    width: 6px;
}

.denominations-container::-webkit-scrollbar-track {
    background: transparent;
}

.denominations-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
}

.denominations-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Schein-Karten */
.note-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 0.625rem 0.75rem;
    display: grid;
    grid-template-areas: 
        "info total"
        "counter counter";
    grid-template-columns: 1fr auto;
    row-gap: 0.5rem;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.note-card:hover, .note-card:focus-within {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.note-color-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
}

/* Schein- und Münz-Farbmarkierungen */
.note-0-1 .note-color-bar { background-color: var(--color-0-1); }
.note-0-2 .note-color-bar { background-color: var(--color-0-2); }
.note-0-5 .note-color-bar { background-color: var(--color-0-5); }
.note-1 .note-color-bar { background-color: var(--color-1); }
.note-2 .note-color-bar { background-color: var(--color-2); }
.note-5 .note-color-bar { background-color: var(--color-5); }
.note-10 .note-color-bar { background-color: var(--color-10); }
.note-20 .note-color-bar { background-color: var(--color-20); }
.note-50 .note-color-bar { background-color: var(--color-50); }
.note-100 .note-color-bar { background-color: var(--color-100); }
.note-200 .note-color-bar { background-color: var(--color-200); }

.note-info {
    grid-area: info;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    overflow: hidden;
}

.note-badge {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    min-width: 2.8rem;
    text-align: center;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Badge-Farbzuweisungen */
.note-0-1 .note-badge {
    background: radial-gradient(circle, #fbbf24 35%, #92400e 50%);
    color: #0b0f19;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.note-0-2 .note-badge {
    background: radial-gradient(circle, #f59e0b 35%, #78350f 50%);
    color: #0b0f19;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.note-0-5 .note-badge {
    background: radial-gradient(circle, #fde047 35%, #a16207 50%);
    color: #0b0f19;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.note-1 .note-badge {
    background: radial-gradient(circle, #e2e8f0 38%, #ca8a04 42%);
    color: #0b0f19;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.note-2 .note-badge {
    background: radial-gradient(circle, #facc15 38%, #94a3b8 42%);
    color: #0b0f19;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.note-5 .note-badge { background: linear-gradient(135deg, #9ca3af, #4b5563); }
.note-10 .note-badge { background: linear-gradient(135deg, #f87171, #dc2626); }
.note-20 .note-badge { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.note-50 .note-badge { background: linear-gradient(135deg, #fb923c, #ea580c); }
.note-100 .note-badge { background: linear-gradient(135deg, #34d399, #059669); }
.note-200 .note-badge { background: linear-gradient(135deg, #facc15, #ca8a04); }

/* Münz-Badges rund gestalten */
.coin-card .note-badge {
    border-radius: 50% !important;
    aspect-ratio: 1 / 1;
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-width: unset;
    font-size: 0.85rem;
}

.note-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Zähler-Steuerung */
.note-counter {
    grid-area: counter;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 2px;
    justify-self: center;
    width: 100%;
    max-width: 120px;
}

.counter-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, transform 0.1s ease;
    user-select: none;
}

.counter-btn:active {
    transform: scale(0.9);
}

.counter-btn.minus:hover {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.counter-btn.plus:hover {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.counter-input {
    width: 100%;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    text-align: center;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    outline: none;
    -moz-appearance: textfield;
}

/* Standard-Pfeile im Input entfernen */
.counter-input::-webkit-outer-spin-button,
.counter-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Schein-Gesamtsumme */
.note-total {
    grid-area: total;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    text-align: right;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
    padding-left: 0.25rem;
}

.note-total span {
    font-size: 1.05rem;
}

/* Aktionen (z. B. Zurücksetzen) */
.app-actions {
    display: flex;
    justify-content: center;
    margin-top: auto;
    animation: fadeIn 1.2s ease 0.4s both;
}

.reset-button {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.875rem 1.75rem;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.reset-button:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #f87171;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.08);
}

.reset-button:active {
    transform: translateY(1px);
}

/* Animationen */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Anpassungen */
@media (max-width: 480px) {
    .app-container {
        padding: 1.25rem 0.875rem 2rem 0.875rem;
    }
    
    .app-header {
        margin-bottom: 1.25rem;
    }
    
    .greeting-name {
        font-size: 1.375rem;
    }
    
    .total-card {
        padding: 1.25rem 1rem;
    }
    
    .total-amount {
        font-size: 2.75rem;
    }
    
    .note-card {
        padding: 0.75rem 0.875rem;
        grid-template-columns: 1.8fr 1.6fr 1fr;
        border-radius: 14px;
        gap: 0.5rem;
    }
    
    .note-badge {
        font-size: 0.95rem;
        padding: 0.25rem 0.5rem;
        min-width: 2.8rem;
        border-radius: 8px;
    }
    
    .note-label {
        font-size: 0.75rem;
    }
    
    .counter-btn {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }
    
    .counter-input {
        width: 36px;
        height: 32px;
        font-size: 0.95rem;
    }
    
    .note-total {
        font-size: 0.95rem;
    }
    
    .note-total span {
        font-size: 1.05rem;
    }
}

/* PWA Installation */
.install-pwa-button {
    background: linear-gradient(135deg, var(--accent-emerald), #059669);
    border: none;
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 0.825rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.875rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.install-pwa-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.install-pwa-button:active {
    transform: translateY(1px);
}

.ios-install-hint {
    margin-top: 0.875rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    text-align: center;
}

.ios-install-hint strong {
    color: var(--text-primary);
}

.ios-share-icon {
    vertical-align: middle;
    margin: 0 2px;
    color: #3b82f6;
}
