/* base.css - 全局变量、重置与基础样式 */

:root {
    --primary-color: #000000;
    --accent-color: #2563EB;
    --bg-color: #F9FAFB;
    --card-bg: #FFFFFF;
    --text-main: #111827;
    --text-sub: #6B7280;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 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);
}

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

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

/* Utils */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.hidden {
    display: none !important;
}

/* Common Buttons (Base Styles) */
.btn-primary-sm {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary-sm:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.btn-text-icon {
    background: transparent;
    border: 1px solid transparent;
    /* Cleaner look without default border */
    color: #4b5563;
    padding: 8px 12px;
    /* Slightly tighter padding */
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    /* Match primary button size */
    transition: all 0.2s;
}

.btn-text-icon:hover {
    background: #f3f4f6;
    color: #111;
}

/* Toast System */
/* Toast System */
.toast-container {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    /* Stack upwards from bottom */
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: rgba(17, 24, 39, 0.85);
    /* Slightly more transparent */
    backdrop-filter: blur(8px);
    /* Premium glass effect */
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toast-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(20px);
        /* Slide up from bottom */
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
        /* Slide down to bottom */
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ====== Image Lightbox (Fullscreen Preview) ====== */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.92);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
    user-select: none;
    -webkit-user-select: none;
}

.lightbox-overlay.hidden {
    display: none !important;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    font-size: 36px;
    color: white;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    z-index: 10001;
}

.lightbox-close:hover {
    opacity: 1;
}

#lightbox-image {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    /* Sharper images on webkit */
    image-rendering: crisp-edges;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    /* Prevent iOS long-press menu conflict if handling touch manually */
}

.lightbox-hint {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    margin-top: 16px;
}

/* Image rendering for canvas area to prevent blur */
#generated-image {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}