/* Feldnah Shared Styles — used by both Shop and Manage */

/* ============================================
   Animations & Keyframes
   ============================================ */

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

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

@keyframes slideInFromBottom {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* ============================================
   Skeleton / Loading
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #2a2e22 25%, #353a2c 50%, #2a2e22 75%);
    background-size: 200% 100%;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 1.5em;
    width: 70%;
    margin-bottom: 0.75em;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-button {
    height: 40px;
    width: 120px;
    border-radius: 8px;
}

.skeleton-card {
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ============================================
   Staggered list animations
   ============================================ */

.stagger-item {
    animation: fadeInUp 0.3s ease-out both;
}

.stagger-item:nth-child(1) { animation-delay: 0s; }
.stagger-item:nth-child(2) { animation-delay: 0.05s; }
.stagger-item:nth-child(3) { animation-delay: 0.1s; }
.stagger-item:nth-child(4) { animation-delay: 0.15s; }
.stagger-item:nth-child(5) { animation-delay: 0.2s; }
.stagger-item:nth-child(6) { animation-delay: 0.25s; }
.stagger-item:nth-child(7) { animation-delay: 0.3s; }
.stagger-item:nth-child(8) { animation-delay: 0.35s; }

/* ============================================
   Page content animations
   ============================================ */

.page-content {
    animation: fadeIn 0.3s ease-out;
}

.page-content-delayed {
    animation: fadeInUp 0.4s ease-out 0.1s both;
}

/* ============================================
   Empty States
   ============================================ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 32px;
    text-align: center;
    gap: 12px;
}

.empty-state-icon {
    font-size: 56px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.empty-state-message {
    max-width: 320px;
    margin: 0;
}

/* ============================================
   Error States
   ============================================ */

.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 32px;
    text-align: center;
    gap: 16px;
}

.error-icon {
    font-size: 64px;
}

.error-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.error-message {
    max-width: 400px;
    margin: 0;
}

.error-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

/* ============================================
   MudBlazor Filled Input overrides
   ============================================ */

.mud-input.mud-input-filled {
    background-color: rgba(82, 108, 43, 0.07);
}

.mud-input.mud-input-filled:hover {
    background-color: rgba(82, 108, 43, 0.12);
}

.mud-input.mud-input-filled.mud-focused {
    background-color: rgba(82, 108, 43, 0.10);
}

[data-theme="dark"] .mud-input.mud-input-filled {
    background-color: rgba(138, 182, 77, 0.1);
}

[data-theme="dark"] .mud-input.mud-input-filled:hover {
    background-color: rgba(138, 182, 77, 0.15);
}

[data-theme="dark"] .mud-input.mud-input-filled.mud-focused {
    background-color: rgba(138, 182, 77, 0.12);
}

/* ============================================
   Cart FAB (shared between Home and Catalog)
   ============================================ */

.cart-fab-wrapper {
    position: fixed;
    top: 68px;
    right: 16px;
    z-index: 100;
    text-decoration: none;
}

.cart-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--mud-palette-secondary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================================
   Receipt / Quittung
   Physischer-Beleg-Look: oben + unten halbkreisförmige
   Abriss-Notches via CSS-Mask. `filter: drop-shadow` folgt
   der gemaskten Silhouette — `box-shadow` würde an den
   ausgeschnittenen Kanten abgeschnitten.
   ============================================ */

.receipt-paper-frame {
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.10));
    max-width: 420px;
    margin: 0 auto;
}

.receipt-paper {
    --notch-r: 9px;
    --notch-w: calc(var(--notch-r) * 2);
    --paper-bg: #ffffff;
    --paper-fg: #2a2e22;
    background: var(--paper-bg);
    color: var(--paper-fg);
    padding: calc(var(--notch-r) + 0.75rem) 1.25rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;

    --receipt-mask:
        radial-gradient(var(--notch-r) at var(--notch-r) 0, #0000 98%, #000 101%)
            calc(-1 * var(--notch-r)) 0 / var(--notch-w) 51% repeat-x,
        radial-gradient(var(--notch-r) at var(--notch-r) 100%, #0000 98%, #000 101%)
            calc(-1 * var(--notch-r)) 100% / var(--notch-w) 51% repeat-x;
    -webkit-mask: var(--receipt-mask);
            mask: var(--receipt-mask);
}

[data-theme="dark"] .receipt-paper {
    --paper-bg: #1e2218;
    --paper-fg: #d4d4c8;
}

[data-theme="dark"] .receipt-paper-frame {
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.40));
}

.receipt-paper-title {
    text-align: center;
    font-weight: 700;
    font-size: 0.9375rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.receipt-paper-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.receipt-paper-divider {
    border: none;
    border-top: 1px dashed currentColor;
    opacity: 0.3;
    margin: 0.65rem 0;
}

.receipt-paper-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 2px 0;
}

.receipt-paper-row > :last-child {
    white-space: nowrap;
}

.receipt-paper-row-total {
    font-weight: 700;
    font-size: 0.9375rem;
    padding: 4px 0;
}

.receipt-paper-footer {
    margin-top: 0.5rem;
    font-size: 0.7rem;
    opacity: 0.7;
    text-align: center;
}

/* ============================================
   Reduced motion preference
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
