/**
 * 暖芒 - 公共样式
 * 余音科技原创开发暖芒，Www.Yuinn.Cn
 */

/* ===== CSS Variables ===== */
:root {
    /* Colors - Warm & Premium */
    --primary: #FF6B35;
    --primary-dark: #E55A2B;
    --primary-light: #FFB000;
    --secondary: #6366F1;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    /* Backgrounds */
    --bg-main: #FDFBFA;
    --bg-card: #FFFFFF;
    --bg-cream: #FFF7F0;
    --bg-input: #F3F4F6;
    --bg-glass: rgba(255, 255, 255, 0.8);

    /* Text */
    --text-primary: #1F2937;
    --text-secondary: #4B5563;
    --text-muted: #9CA3AF;

    /* Borders */
    --border-color: #E5E7EB;
    --border-light: #F3F4F6;

    /* Gradients */
    --primary-gradient: linear-gradient(135deg, #FFB000 0%, #FF6B35 100%);
    --glass-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.1) 100%);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-premium: 0 10px 30px -10px rgba(255, 107, 53, 0.4);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Safe Areas */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background: var(--bg-main);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    border: none;
    cursor: pointer;
    background: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    cursor: pointer;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(230, 126, 34, 0.4);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-light);
}

.btn-outline {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.badge-primary {
    background: rgba(230, 126, 34, 0.15);
    color: var(--primary);
}

.badge-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.badge-success {
    background: rgba(39, 174, 96, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger);
}

.badge-info {
    background: rgba(52, 152, 219, 0.15);
    color: var(--info);
}

/* ===== Alerts ===== */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.alert-warning {
    background: rgba(243, 156, 18, 0.1);
    color: #B7791F;
    border: 1px solid rgba(243, 156, 18, 0.2);
}

.alert-danger {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.alert-info {
    background: rgba(52, 152, 219, 0.1);
    color: var(--info);
    border: 1px solid rgba(52, 152, 219, 0.2);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
}

.card-body {
    padding: 1rem;
}

.card-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-input);
}

/* ===== Search Bar ===== */
.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    padding: 0 1rem;
    gap: 0.75rem;
}

.search-bar i {
    color: var(--text-muted);
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    padding: 0.75rem 0;
    font-size: 0.95rem;
    outline: none;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 1rem;
}

/* ===== Loading Spinner ===== */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: calc(1rem + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    animation: toastIn 0.3s ease;
    backdrop-filter: blur(10px);
}

.toast.success {
    background: rgba(39, 174, 96, 0.95);
}

.toast.error {
    background: rgba(231, 76, 60, 0.95);
}

.toast.warning {
    background: rgba(243, 156, 18, 0.95);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Utilities ===== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--primary);
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.d-flex {
    display: flex;
}

.flex-1 {
    flex: 1;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.shop-card {
    animation: fadeIn 0.4s ease backwards;
}

.shop-card:nth-child(1) {
    animation-delay: 0.1s;
}

.shop-card:nth-child(2) {
    animation-delay: 0.15s;
}

.shop-card:nth-child(3) {
    animation-delay: 0.2s;
}

.shop-card:nth-child(4) {
    animation-delay: 0.25s;
}

.category-item {
    transition: transform 0.2s;
}

.category-item:hover {
    transform: translateY(-2px);
}

/* ===== Application Layout ===== */
.app-header {
    background: var(--bg-card);
    padding: 1rem;
    padding-top: calc(1rem + var(--safe-top));
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-light);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.location-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.location-selector i:first-child {
    color: var(--primary);
}

/* Banner */
.banner-container {
    padding: 1rem;
}

.banner-slide {
    transition: transform 0.3s ease;
    border-radius: var(--radius-xl) !important;
}

.banner-slide:active {
    transform: scale(0.98);
}

/* Category Scroll */
.category-scroll {
    display: flex;
    overflow-x: auto;
    padding: 1rem;
    gap: 1.25rem;
    scrollbar-width: none;
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.category-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.2s;
}

.category-item:active .category-icon {
    transform: scale(0.9);
}

.category-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Shop Card */
.section {
    padding: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-more {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.shop-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.shop-card:active {
    transform: scale(0.98);
}

.shop-card-image {
    width: 90px;
    height: 90px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.shop-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.shop-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.shop-card-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.shop-card-rating .score {
    color: #FFB000;
    font-weight: 700;
}

.shop-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.25rem 0;
}

.shop-card-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.shop-tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-secondary);
}

.shop-tag.featured {
    background: rgba(255, 107, 53, 0.1);
    color: var(--primary);
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    padding-bottom: calc(0.75rem + var(--safe-bottom));
    border-top: 1px solid var(--border-light);
    z-index: 2000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item i {
    font-size: 1.4rem;
}

/* PWA Prompt */
.pwa-prompt {
    position: fixed;
    bottom: calc(5rem + var(--safe-bottom));
    left: 1rem;
    right: 1rem;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-lg);
    z-index: 1500;
    border: 1px solid var(--border-light);
    animation: fadeIn 0.5s ease-out;
}

.pwa-prompt-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.pwa-prompt-content {
    flex: 1;
}

.pwa-prompt-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.1rem;
}

.pwa-prompt-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}