/* ============================================
   AnyPrompts 提示詞抓取器
   Mac OS Bright Style Design System
   v1.1 — SEO sections + Language switcher
   ============================================ */

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

:root {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #fafafa;
    --bg-hover: #f0f0f2;
    --bg-glass: rgba(255, 255, 255, 0.72);

    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --text-placeholder: #aeaeb2;

    --border-color: #d2d2d7;
    --border-light: #e8e8ed;
    --border-focus: #007aff;

    --accent-blue: #007aff;
    --accent-blue-hover: #0056cc;
    --accent-blue-light: rgba(0, 122, 255, 0.08);
    --accent-green: #34c759;
    --accent-red: #ff3b30;
    --accent-red-hover: #d70015;
    --accent-orange: #ff9500;
    --accent-purple: #af52de;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-focus: 0 0 0 4px rgba(0, 122, 255, 0.25);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Header === */
.app-header {
    background: var(--bg-glass);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header__inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.app-header__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.app-header__icon {
    font-size: 28px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

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

.app-header__text small {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 400;
}

.app-header__right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.app-header__quota {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-light);
    white-space: nowrap;
}

.quota-icon { font-size: 13px; }

/* === Language Switcher === */
.lang-switcher {
    position: relative;
}

.lang-select {
    padding: 5px 28px 5px 10px;
    font-size: 12px;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236e6e73' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: var(--transition);
}

.lang-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}

.lang-select:hover {
    border-color: var(--accent-blue);
}

/* === Hero Section === */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: #fff;
    padding: 48px 24px 40px;
    text-align: center;
}

.hero-inner {
    max-width: 760px;
    margin: 0 auto;
}

.hero-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 14px;
    line-height: 1.3;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.hero-desc {
    font-size: 15px;
    line-height: 1.7;
    opacity: 0.92;
    margin-bottom: 24px;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.25);
    white-space: nowrap;
}

/* === Main Content === */
.app-main {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* === Card === */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card__header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
}

.card__header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.card__badge {
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-blue);
    background: var(--accent-blue-light);
    padding: 3px 10px;
    border-radius: 20px;
}

.card__body { padding: 20px; }

/* === Upload Zone === */
.upload-zone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-tertiary);
}

.upload-zone:hover,
.upload-zone--active {
    border-color: var(--accent-blue);
    background: var(--accent-blue-light);
}

.upload-zone--active { transform: scale(1.01); }

.upload-zone__icon { font-size: 36px; margin-bottom: 10px; }

.upload-zone__text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

.upload-zone__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* === Thumbnail List === */
.thumbnail-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.thumbnail-list:empty { display: none; }

.thumbnail-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border-light);
    cursor: default;
    transition: var(--transition);
}

.thumbnail-item:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-md);
}

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

.thumbnail-item__index {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
}

.thumbnail-item__remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 59, 48, 0.85);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    line-height: 1;
}

.thumbnail-item:hover .thumbnail-item__remove { opacity: 1; }

.thumbnail-item__remove:hover {
    background: var(--accent-red);
    transform: scale(1.1);
}

.thumbnail-item__status {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3px;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
}

.thumbnail-item__status--processing { background: rgba(0, 122, 255, 0.8); }
.thumbnail-item__status--done { background: rgba(52, 199, 89, 0.8); }
.thumbnail-item__status--error { background: rgba(255, 59, 48, 0.8); }

/* === Model Selector === */
.model-selector { max-width: 100%; }

/* === Form Elements === */
.form-select,
.form-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236e6e73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}

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

/* === Options Grid === */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.option-group--full,
.option-group--checkbox {
    grid-column: 1 / -1;
}

.option-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* === Checkbox === */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    user-select: none;
}

.checkbox-label input[type="checkbox"] { display: none; }

.checkbox-custom {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* === Action Bar === */
.action-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-bar__secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-family);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    user-select: none;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn__icon { font-size: 15px; }

.btn--primary {
    background: linear-gradient(180deg, #2196F3 0%, #1976D2 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.btn--primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #1E88E5 0%, #1565C0 100%);
    box-shadow: 0 4px 14px rgba(0, 122, 255, 0.4);
    transform: translateY(-1px);
}

.btn--large {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-md);
}

.btn--secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    flex: 1;
    min-width: 0;
}

.btn--secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.btn--danger {
    background: var(--bg-secondary);
    color: var(--accent-red);
    border: 1px solid var(--border-color);
}

.btn--danger:hover:not(:disabled) {
    background: rgba(255, 59, 48, 0.08);
    border-color: var(--accent-red);
}

.btn--sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
}

/* === Results === */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.result-card:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-sm);
}

.result-card__thumb {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border-light);
}

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

.result-card__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-card__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}


.result-card__prompt {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    font-size: 13px;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    resize: vertical;
    line-height: 1.5;
    transition: var(--transition);
}

.result-card__prompt:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}

.result-card__actions { display: flex; gap: 8px; }

.result-card--error {
    border-color: rgba(255, 59, 48, 0.3);
    background: rgba(255, 59, 48, 0.04);
}

.result-card__error-text {
    color: var(--accent-red);
    font-size: 13px;
}

/* === Loading Overlay === */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(245, 245, 247, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

.loading-overlay--visible { display: flex; }

.loading-overlay__content {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-overlay__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.loading-overlay__progress {
    font-size: 14px;
    color: var(--text-secondary);
}

/* === Toast === */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease-out;
    max-width: 360px;
}

.toast--success { background: var(--accent-green); }
.toast--error { background: var(--accent-red); }
.toast--info { background: var(--accent-blue); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* === Features Section === */
.features-section {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    padding: 56px 24px;
}

.features-inner {
    max-width: 960px;
    margin: 0 auto;
}

.features-heading {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 36px;
    letter-spacing: -0.3px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.feature-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-blue);
}

.feature-card__icon {
    font-size: 36px;
    margin-bottom: 14px;
}

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

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

/* === How-to Section === */
.howto-section {
    background: var(--bg-primary);
    padding: 56px 24px;
}

.howto-inner {
    max-width: 800px;
    margin: 0 auto;
}

.howto-heading {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 36px;
    letter-spacing: -0.3px;
}

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

.howto-step {
    text-align: center;
    position: relative;
}

.howto-step__num {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.howto-step h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.howto-step p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* === Footer === */
.app-footer {
    text-align: center;
    padding: 24px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
}

.footer-brand {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.footer-seo {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
    .app-header__inner {
        padding: 8px 16px;
    }

    .app-header__text h1 { font-size: 16px; }

    .app-header__right { gap: 6px; }

    .app-header__quota {
        font-size: 11px;
        padding: 4px 8px;
    }

    .lang-select {
        font-size: 11px;
        padding: 4px 22px 4px 8px;
    }

    .hero-section { padding: 36px 20px 28px; }
    .hero-title { font-size: 22px; }
    .hero-desc { font-size: 14px; }
    .hero-badge { font-size: 12px; padding: 5px 12px; }

    .app-main { padding: 16px; gap: 16px; }

    .card__header { padding: 12px 16px; }
    .card__body { padding: 16px; }

    .options-grid { grid-template-columns: 1fr; }

    .action-bar__secondary { flex-direction: column; }
    .action-bar__secondary .btn { width: 100%; }

    .result-card { flex-direction: column; }
    .result-card__thumb { width: 100%; height: 160px; }

    .thumbnail-list {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }

    .features-grid { grid-template-columns: repeat(2, 1fr); }

    .howto-steps { grid-template-columns: repeat(2, 1fr); gap: 24px; }

    .features-section,
    .howto-section { padding: 40px 20px; }
}

/* Mobile */
@media (max-width: 480px) {
    .app-header__inner {
        flex-wrap: wrap;
        padding: 8px 12px;
    }

    .app-header__brand { gap: 8px; }

    .app-header__icon {
        font-size: 22px;
        width: 34px;
        height: 34px;
        border-radius: var(--radius-sm);
    }

    .app-header__text h1 { font-size: 15px; }
    .app-header__text small { font-size: 10px; }

    .app-header__right {
        gap: 6px;
    }

    .app-header__quota {
        font-size: 10px;
        padding: 3px 7px;
    }

    .lang-select {
        font-size: 10px;
        padding: 3px 20px 3px 6px;
    }

    .hero-section { padding: 28px 16px 24px; }
    .hero-title { font-size: 19px; }
    .hero-desc { font-size: 13px; }
    .hero-badges { gap: 6px; }
    .hero-badge { font-size: 11px; padding: 4px 10px; }

    .app-main { padding: 12px; gap: 12px; }

    .upload-zone { padding: 24px 14px; }
    .upload-zone__icon { font-size: 30px; }
    .upload-zone__text { font-size: 14px; }

    .card__header h2 { font-size: 14px; }

    .btn--large { padding: 12px 16px; font-size: 15px; }

    .toast-container { left: 12px; right: 12px; bottom: 12px; }
    .toast { max-width: 100%; }

    .result-card__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .thumbnail-list {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }

    .features-grid { grid-template-columns: 1fr; }
    .feature-card { padding: 20px 16px; }

    .howto-steps { grid-template-columns: 1fr 1fr; gap: 20px; }

    .features-section,
    .howto-section { padding: 32px 16px; }

    .features-heading,
    .howto-heading { font-size: 20px; margin-bottom: 24px; }
}

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

.card { animation: fadeInUp 0.4s ease-out; }
.result-card { animation: fadeInUp 0.3s ease-out; }
.feature-card { animation: fadeInUp 0.4s ease-out; }
.howto-step { animation: fadeInUp 0.4s ease-out; }
