/* BeautyAI Lab - Global Styles */
:root {
    --primary-color: #ff6b9d;
    --primary-dark: #e85a8a;
    --secondary-color: #7c3aed;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lang-icon {
    font-size: 12px;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-top: 56px;
    padding-bottom: 70px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Hero Section */
.hero {
    position: relative;
    height: 280px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/images/hero_banner.jpg?v=2') center top/cover no-repeat;
}

.hero-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.45), rgba(124, 58, 237, 0.45));
}

.hero-content {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: white;
}

.hero h1 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero p {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 20px;
}

/* Buttons */
.btn-primary {
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 12px 32px;
    border-radius: var(--radius-full);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-large {
    padding: 14px 40px;
    font-size: 17px;
}

/* Section Title */
.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.view-all {
    font-size: 14px;
    color: var(--primary-color);
    text-decoration: none;
}

/* Features Section */
.features {
    padding: 24px 16px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.feature-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-card:active {
    transform: translateY(-2px);
}

.feature-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.feature-icon.color-icon {
    background: linear-gradient(135deg, #f472b6, #fb923c);
}

.feature-icon.skin-icon {
    background: linear-gradient(135deg, #a78bfa, #60a5fa);
}

.feature-icon.hair-icon {
    background: linear-gradient(135deg, #34d399, #22d3ee);
}

.feature-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.feature-card p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Coupon Section */
.coupon-section {
    padding: 0 16px 24px;
}

.coupon-card {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.coupon-card::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: var(--bg-color);
    border-radius: var(--radius-full);
}

.coupon-card::after {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: var(--bg-color);
    border-radius: var(--radius-full);
}

.coupon-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.coupon-value {
    display: flex;
    align-items: baseline;
    color: #d97706;
}

.coupon-value .currency {
    font-size: 16px;
    font-weight: 600;
}

.coupon-value .amount {
    font-size: 36px;
    font-weight: 700;
}

.coupon-info h3 {
    font-size: 15px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 4px;
}

.coupon-info p {
    font-size: 12px;
    color: #b45309;
}

.btn-claim {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    white-space: nowrap;
}

.btn-claim:hover {
    transform: scale(1.05);
}

/* Stores Section */
.stores-section {
    padding: 0 16px 24px;
}

.store-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.store-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
}

.store-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-lg);
}

.store-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    font-size: 24px;
    overflow: hidden;
}

.store-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.store-info {
    flex: 1;
    min-width: 0;
}

.store-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.store-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.store-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--accent-color);
}

.store-address {
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 60px;
    padding: 0 16px;
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 11px;
    padding: 8px 16px;
    transition: color 0.2s;
}

.nav-item svg {
    margin-bottom: 4px;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item:hover {
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 375px) {
    .hero h1 {
        font-size: 22px;
    }

    .feature-card {
        padding: 20px 12px;
    }

    .coupon-value .amount {
        font-size: 30px;
    }
}

/* Analysis Page Styles */
.page-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--card-bg);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: var(--shadow);
}

.back-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
}

.page-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
}

.upload-area {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    margin: 16px;
    padding: 40px 20px;
    text-align: center;
    border: 2px dashed var(--border-color);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(255, 107, 157, 0.05);
}

.upload-area.has-image {
    padding: 16px;
    border-style: solid;
    border-color: var(--primary-color);
}

.upload-preview {
    width: 100%;
    max-width: 300px;
    border-radius: var(--radius);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.upload-text h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.upload-text p {
    font-size: 13px;
    color: var(--text-secondary);
}

.upload-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 10px 24px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Template Selection */
.template-section {
    padding: 0 16px 24px;
}

.template-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.template-tab {
    padding: 8px 16px;
    background: var(--bg-color);
    border: none;
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.template-tab.active {
    background: var(--primary-color);
    color: white;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.template-item {
    aspect-ratio: 1;
    border-radius: var(--radius);
    background: var(--bg-color);
    cursor: pointer;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
}

.template-item:hover {
    transform: scale(1.05);
}

.template-item.selected {
    border-color: var(--primary-color);
}

.template-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Submit Button */
.submit-section {
    padding: 16px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-submit {
    width: 100%;
    max-width: 448px;
    margin: 0 auto;
    display: block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 14px;
    border-radius: var(--radius-full);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.btn-submit:hover {
    transform: translateY(-2px);
}

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

/* Results Page */
.result-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
}

.result-image {
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 3/4;
    background: var(--bg-color);
}

.result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-label {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.analysis-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    margin: 0 16px 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.analysis-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-card h3 svg {
    color: var(--primary-color);
}

.analysis-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.issue-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.issue-tag {
    padding: 6px 12px;
    background: rgba(255, 107, 157, 0.1);
    color: var(--primary-color);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
}

/* Recommendation Cards */
.recommendation-section {
    padding: 0 16px 100px;
}

.recommendation-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.recommendation-card.featured {
    border: 2px solid var(--primary-color);
    position: relative;
}

.recommendation-card.featured::before {
    content: 'Best Match';
    position: absolute;
    top: -10px;
    left: 16px;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.recommendation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.recommendation-title h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.recommendation-match {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.match-tag {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(124, 58, 237, 0.1);
    color: var(--secondary-color);
    border-radius: var(--radius-full);
}

.recommendation-price {
    text-align: right;
}

.original-price {
    font-size: 12px;
    color: var(--text-light);
    text-decoration: line-through;
}

.current-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.recommendation-store {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin: 12px 0;
}

.store-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.store-details h5 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.store-details span {
    font-size: 12px;
    color: var(--text-secondary);
}

.recommendation-actions {
    display: flex;
    gap: 12px;
}

.btn-buy {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-coupon {
    flex: 1;
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Toast */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    z-index: 3000;
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    20%, 80% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Credit Toast */
.credit-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    z-index: 3000;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    animation: creditToastIn 0.3s ease-out;
}

.credit-toast.fade-out {
    animation: creditToastOut 0.3s ease-in forwards;
}

.credit-toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.credit-toast-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.credit-toast-info {
    display: flex;
    flex-direction: column;
}

.credit-toast-message {
    font-size: 14px;
    font-weight: 500;
}

.credit-toast-message strong {
    font-size: 16px;
}

.credit-toast-balance {
    font-size: 12px;
    opacity: 0.9;
}

@keyframes creditToastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes creditToastOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Score Bar */
.score-bar {
    height: 8px;
    background: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.score-label {
    width: 60px;
    font-size: 13px;
    color: var(--text-secondary);
}

.score-value {
    width: 30px;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}
