@charset "UTF-8";

/* ===== Text to Image Page Styles ===== */

/* ===== Keyframe Animations ===== */
@keyframes ttiFadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ttiSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ttiPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes ttiShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes ttiProgressBar {
    0% { width: 0%; }
    20% { width: 15%; }
    40% { width: 35%; }
    60% { width: 55%; }
    80% { width: 75%; }
    95% { width: 88%; }
    100% { width: 92%; }
}

@keyframes ttiFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes ttiGlow {
    0%, 100% { box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4); }
    50% { box-shadow: 0 6px 30px rgba(124, 58, 237, 0.6); }
}

/* ===== Page Container ===== */
.tti-page {
    width: 100%;
    min-height: 100vh;
}

.tti-page .tti-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px 60px;
}

/* ===== Hero Section ===== */
.tti-page .tti-hero {
    padding: 50px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.tti-page .tti-hero-content {
    position: relative;
    z-index: 1;
}

.tti-page .tti-hero-icon i {
    font-size: 56px;
    color: #fff;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: block;
    margin-bottom: 16px;
}

.tti-page .tti-hero h1 {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 14px 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.tti-page .tti-hero-desc {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.85);
    max-width: 650px;
    margin: 0 auto 20px;
    line-height: 1.7;
}

.tti-page .tti-hero-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.tti-page .tti-tag {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 12px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ===== Usage Bar ===== */
.tti-page .tti-usage-bar {
    margin-bottom: 24px;
}

.tti-page .tti-usage-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    background: var(--card_bg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    font-size: 14px;
    color: var(--font_2);
}

.tti-page .tti-usage-info i {
    color: var(--active);
    font-size: 16px;
}

.tti-page .tti-usage-info.admin-mode {
    border-left: 3px solid #10b981;
}

.tti-page .tti-usage-info.admin-mode i {
    color: #10b981;
}

.tti-page .tti-usage-info.limit-reached {
    border-left: 3px solid #ef4444;
    color: #ef4444;
}

.tti-page .tti-usage-info.limit-reached i {
    color: #ef4444;
}

/* ===== Input Section ===== */
.tti-page .tti-input-section {
    background: var(--card_bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
    animation: ttiFadeInUp 0.5s ease forwards;
}

/* Prompt Textarea */
.tti-page .tti-prompt-group {
    margin-bottom: 24px;
}

.tti-page .tti-prompt-group label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--font_1);
    margin-bottom: 10px;
}

.tti-page .tti-prompt-group label i {
    margin-right: 6px;
    color: var(--active);
}

.tti-page .tti-prompt-wrap {
    position: relative;
}

.tti-page .tti-prompt-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 1px solid rgba(85, 85, 85, 0.2);
    border-radius: 10px;
    background: var(--bg);
    color: var(--font_1);
    font-size: 14px;
    line-height: 1.8;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.tti-page .tti-prompt-textarea:focus {
    outline: none;
    border-color: var(--active);
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
}

.tti-page .tti-char-count {
    position: absolute;
    right: 12px;
    bottom: 10px;
    font-size: 12px;
    color: var(--font_2);
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
}

.tti-page .tti-char-count.warn {
    color: #ef4444;
}

/* ===== Style Tags ===== */
.tti-page .tti-style-group {
    margin-bottom: 24px;
}

.tti-page .tti-style-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--font_1);
    margin-bottom: 10px;
}

.tti-page .tti-style-group label i {
    margin-right: 6px;
    color: var(--active);
}

.tti-page .tti-style-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tti-page .tti-style-tag {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid rgba(85, 85, 85, 0.25);
    background: var(--bg);
    color: var(--font_1);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.tti-page .tti-style-tag:hover {
    border-color: var(--active);
    color: var(--active);
    transform: scale(1.03);
}

.tti-page .tti-style-tag.active {
    background: var(--active);
    color: #fff;
    border-color: var(--active);
    box-shadow: 0 2px 10px rgba(64, 158, 255, 0.3);
    transform: scale(1.03);
}

/* ===== Size Selection ===== */
.tti-page .tti-size-group {
    margin-bottom: 24px;
}

.tti-page .tti-size-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--font_1);
    margin-bottom: 10px;
}

.tti-page .tti-size-group label i {
    margin-right: 6px;
    color: var(--active);
}

.tti-page .tti-size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tti-page .tti-size-btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid rgba(85, 85, 85, 0.25);
    background: var(--bg);
    color: var(--font_1);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tti-page .tti-size-btn .tti-size-ratio {
    font-weight: 600;
}

.tti-page .tti-size-btn .tti-size-px {
    font-size: 11px;
    color: var(--font_2);
}

.tti-page .tti-size-btn:hover {
    border-color: var(--active);
    color: var(--active);
}

.tti-page .tti-size-btn.active {
    background: var(--active);
    color: #fff;
    border-color: var(--active);
    box-shadow: 0 2px 10px rgba(64, 158, 255, 0.3);
}

.tti-page .tti-size-btn.active .tti-size-px {
    color: rgba(255, 255, 255, 0.8);
}

/* ===== Number Selection ===== */
.tti-page .tti-num-group {
    margin-bottom: 24px;
}

.tti-page .tti-num-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--font_1);
    margin-bottom: 10px;
}

.tti-page .tti-num-group label i {
    margin-right: 6px;
    color: var(--active);
}

.tti-page .tti-num-options {
    display: flex;
    gap: 10px;
}

.tti-page .tti-num-btn {
    padding: 8px 20px;
    border-radius: 8px;
    border: 1px solid rgba(85, 85, 85, 0.25);
    background: var(--bg);
    color: var(--font_1);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tti-page .tti-num-btn:hover {
    border-color: var(--active);
    color: var(--active);
}

.tti-page .tti-num-btn.active {
    background: var(--active);
    color: #fff;
    border-color: var(--active);
    box-shadow: 0 2px 10px rgba(64, 158, 255, 0.3);
}

/* ===== Advanced Options ===== */
.tti-page .tti-advanced-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 0;
    font-size: 14px;
    color: var(--font_2);
    user-select: none;
    border: none;
    background: transparent;
    transition: color 0.2s ease;
}

.tti-page .tti-advanced-toggle:hover {
    color: var(--font_1);
}

.tti-page .tti-advanced-toggle i {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.tti-page .tti-advanced-toggle.open i {
    transform: rotate(90deg);
}

.tti-page .tti-advanced-body {
    display: none;
    padding-top: 12px;
}

.tti-page .tti-advanced-body.show {
    display: block;
    animation: ttiFadeInUp 0.3s ease forwards;
}

.tti-page .tti-neg-prompt-textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid rgba(85, 85, 85, 0.2);
    border-radius: 8px;
    background: var(--bg);
    color: var(--font_1);
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.tti-page .tti-neg-prompt-textarea:focus {
    outline: none;
    border-color: var(--active);
}

.tti-page .tti-neg-prompt-hint {
    font-size: 12px;
    color: var(--font_2);
    margin-top: 6px;
}

/* ===== Submit Button ===== */
.tti-page .tti-action {
    text-align: center;
    margin-bottom: 24px;
}

.tti-page .tti-submit-btn {
    padding: 14px 48px;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 50%, #3b82f6 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.tti-page .tti-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(124, 58, 237, 0.55);
}

.tti-page .tti-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: rgba(85, 85, 85, 0.4);
}

.tti-page .tti-submit-btn i {
    margin-right: 8px;
}

/* ===== Loading Section ===== */
.tti-page .tti-loading {
    background: var(--card_bg);
    border-radius: 12px;
    padding: 50px 30px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
    animation: ttiFadeInUp 0.5s ease forwards;
}

.tti-page .tti-loading-shimmer {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, rgba(124,58,237,0.15) 25%, rgba(99,102,241,0.5) 50%, rgba(124,58,237,0.15) 75%);
    background-size: 200% 100%;
    animation: ttiShimmer 2s ease-in-out infinite;
    margin-bottom: 30px;
}

.tti-page .tti-loading-icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: ttiPulse 1.5s ease-in-out infinite;
}

.tti-page .tti-loading-icon i {
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tti-page .tti-loading-text {
    font-size: 17px;
    color: var(--font_1);
    font-weight: 500;
    margin: 0 0 10px 0;
}

.tti-page .tti-loading-hint {
    font-size: 13px;
    color: var(--font_2);
    margin: 0 0 24px 0;
}

.tti-page .tti-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(85, 85, 85, 0.15);
    border-radius: 2px;
    overflow: hidden;
}

.tti-page .tti-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #3b82f6);
    border-radius: 2px;
    animation: ttiProgressBar 25s ease-out forwards;
}

/* ===== Result Section ===== */
.tti-page .tti-result {
    animation: ttiSlideUp 0.6s ease forwards;
}

.tti-page .tti-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tti-page .tti-result-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--font_1);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tti-page .tti-result-header h3 i {
    color: #7c3aed;
}

.tti-page .tti-expire-hint {
    font-size: 12px;
    color: #f59e0b;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(245, 158, 11, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
}

/* Image Gallery Grid */
.tti-page .tti-gallery {
    display: grid;
    gap: 16px;
    margin-bottom: 20px;
}

.tti-page .tti-gallery.cols-1 {
    grid-template-columns: 1fr;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.tti-page .tti-gallery.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.tti-page .tti-gallery.cols-4 {
    grid-template-columns: repeat(2, 1fr);
}

.tti-page .tti-gallery-item {
    background: var(--card_bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    animation: ttiFadeIn 0.5s ease forwards;
    opacity: 0;
}

.tti-page .tti-gallery-item:nth-child(1) { animation-delay: 0.1s; }
.tti-page .tti-gallery-item:nth-child(2) { animation-delay: 0.2s; }
.tti-page .tti-gallery-item:nth-child(3) { animation-delay: 0.3s; }
.tti-page .tti-gallery-item:nth-child(4) { animation-delay: 0.4s; }

.tti-page .tti-gallery-item .tti-img-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    cursor: pointer;
}

.tti-page .tti-gallery-item .tti-img-wrap img,
.tti-page .tti-gallery-item .tti-img-wrap .el-image {
    width: 100%;
    display: block;
    transition: transform 0.3s ease;
}

.tti-page .tti-gallery-item:hover .tti-img-wrap img,
.tti-page .tti-gallery-item:hover .tti-img-wrap .el-image {
    transform: scale(1.03);
}

.tti-page .tti-gallery-item .el-image img {
    width: 100%;
    display: block;
}

.tti-page .tti-img-actions {
    display: flex;
    justify-content: center;
    padding: 12px;
    gap: 10px;
}

.tti-page .tti-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    color: #fff;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.tti-page .tti-download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(124, 58, 237, 0.3);
}

/* Result Action Bar */
.tti-page .tti-result-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    background: var(--card_bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.tti-page .tti-result-btn {
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tti-page .tti-regenerate-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
    color: #fff;
    box-shadow: 0 3px 12px rgba(124, 58, 237, 0.3);
}

.tti-page .tti-regenerate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 18px rgba(124, 58, 237, 0.4);
}

.tti-page .tti-newjob-btn {
    background: var(--bg);
    color: var(--font_1);
    border: 1px solid rgba(85, 85, 85, 0.2);
}

.tti-page .tti-newjob-btn:hover {
    border-color: var(--active);
    color: var(--active);
}

/* ===== Toast ===== */
.tti-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #333;
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    text-align: center;
}

.tti-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.tti-toast.success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.tti-toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* ===== Responsive Design ===== */

/* Tablet and below */
@media (max-width: 768px) {
    .tti-page .tti-container {
        padding: 20px 16px 50px;
    }

    .tti-page .tti-hero {
        padding: 40px 16px;
    }

    .tti-page .tti-hero h1 {
        font-size: 26px;
    }

    .tti-page .tti-hero-icon i {
        font-size: 46px;
    }

    .tti-page .tti-hero-desc {
        font-size: 14px;
    }

    .tti-page .tti-input-section {
        padding: 20px;
    }

    .tti-page .tti-submit-btn {
        width: 100%;
        padding: 14px 24px;
    }

    .tti-page .tti-style-tags {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .tti-page .tti-style-tag {
        text-align: center;
    }

    .tti-page .tti-size-options {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .tti-page .tti-size-btn {
        justify-content: center;
    }

    .tti-page .tti-gallery.cols-2,
    .tti-page .tti-gallery.cols-4 {
        grid-template-columns: 1fr;
    }

    .tti-page .tti-gallery.cols-1 {
        max-width: 100%;
    }

    .tti-page .tti-result-actions {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .tti-page .tti-result-btn {
        width: 100%;
        justify-content: center;
    }

    .tti-page .tti-result-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .tti-page .tti-usage-info {
        flex-wrap: wrap;
        font-size: 13px;
    }

    .tti-page .tti-loading {
        padding: 40px 20px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .tti-page .tti-hero h1 {
        font-size: 22px;
    }

    .tti-page .tti-hero-icon i {
        font-size: 40px;
    }

    .tti-page .tti-tag {
        font-size: 11px;
        padding: 3px 10px;
    }

    .tti-page .tti-prompt-textarea {
        min-height: 100px;
    }

    .tti-page .tti-num-options {
        flex-wrap: wrap;
    }
}

/* ===== Dark Mode Enhancements ===== */
@media (prefers-color-scheme: dark) {
    .tti-page .tti-input-section,
    .tti-page .tti-loading,
    .tti-page .tti-gallery-item,
    .tti-page .tti-result-actions {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    }

    .tti-page .tti-prompt-textarea,
    .tti-page .tti-neg-prompt-textarea {
        border-color: rgba(255, 255, 255, 0.15);
    }

    .tti-page .tti-style-tag {
        border-color: rgba(255, 255, 255, 0.15);
    }

    .tti-page .tti-size-btn,
    .tti-page .tti-num-btn {
        border-color: rgba(255, 255, 255, 0.15);
    }

    .tti-page .tti-newjob-btn {
        border-color: rgba(255, 255, 255, 0.15);
    }

    .tti-page .tti-usage-info {
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    }

    .tti-toast {
        background: #444;
    }
}

/* ===== Accessibility ===== */
.tti-page .tti-submit-btn:focus,
.tti-page .tti-style-tag:focus,
.tti-page .tti-size-btn:focus,
.tti-page .tti-num-btn:focus,
.tti-page .tti-prompt-textarea:focus,
.tti-page .tti-neg-prompt-textarea:focus,
.tti-page .tti-result-btn:focus,
.tti-page .tti-download-btn:focus {
    outline: 2px solid var(--active);
    outline-offset: 2px;
}

.tti-page .tti-submit-btn:focus:not(:focus-visible),
.tti-page .tti-style-tag:focus:not(:focus-visible),
.tti-page .tti-size-btn:focus:not(:focus-visible),
.tti-page .tti-num-btn:focus:not(:focus-visible),
.tti-page .tti-result-btn:focus:not(:focus-visible),
.tti-page .tti-download-btn:focus:not(:focus-visible) {
    outline: none;
}

.tti-page .tti-submit-btn:focus-visible,
.tti-page .tti-style-tag:focus-visible,
.tti-page .tti-size-btn:focus-visible,
.tti-page .tti-num-btn:focus-visible,
.tti-page .tti-result-btn:focus-visible,
.tti-page .tti-download-btn:focus-visible {
    outline: 2px solid var(--active);
    outline-offset: 2px;
}

/* ===== Reduced Motion Support ===== */
@media (prefers-reduced-motion: reduce) {
    .tti-page .tti-gallery-item,
    .tti-page .tti-input-section,
    .tti-page .tti-loading,
    .tti-page .tti-result {
        animation: none;
        opacity: 1;
    }

    .tti-page .tti-loading-icon {
        animation: none;
    }

    .tti-page .tti-loading-shimmer {
        animation: none;
    }

    .tti-page .tti-progress-fill {
        animation: none;
        width: 50%;
    }

    .tti-page .tti-submit-btn,
    .tti-page .tti-style-tag,
    .tti-page .tti-size-btn,
    .tti-page .tti-num-btn,
    .tti-page .tti-download-btn,
    .tti-page .tti-result-btn,
    .tti-page .tti-toast {
        transition: none;
    }

    .tti-page .tti-submit-btn:hover,
    .tti-page .tti-regenerate-btn:hover,
    .tti-page .tti-download-btn:hover,
    .tti-page .tti-gallery-item:hover .tti-img-wrap img,
    .tti-page .tti-gallery-item:hover .tti-img-wrap .el-image {
        transform: none;
    }
}
