/* ===================================================
   STYLE TRAINER PAGE  –  Isolated CSS
   All rules prefixed with .st- to avoid collisions
   =================================================== */

/* Page wrapper */
.st-page {
    min-height: 100vh;
    background: var(--bg-gradient);
    padding: 100px 24px 60px;
}

.st-inner {
    max-width: 760px;
    margin: 0 auto;
}

/* Page heading */
.st-heading {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.5px;
    margin-bottom: 16px;
}

/* Info note */
.st-note {
    background: rgba(16, 185, 129, 0.07);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    color: var(--text-dim);
    font-size: 0.875rem;
    line-height: 1.65;
    margin-bottom: 32px;
}

/* Upload area */
.st-upload-zone {
    border: 2px dashed rgba(16, 185, 129, 0.35);
    border-radius: var(--radius-md);
    background: rgba(16, 185, 129, 0.04);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    margin-bottom: 24px;
    padding: 32px 16px;
    position: relative;
}

.st-upload-zone:hover,
.st-upload-zone.dragover {
    border-color: var(--neon-green);
    background: rgba(16, 185, 129, 0.09);
}

.st-upload-icon {
    width: 48px;
    height: 48px;
    stroke: var(--neon-green);
    opacity: 0.75;
}

.st-upload-label {
    color: var(--text-dim);
    font-size: 1rem;
    text-align: center;
    pointer-events: none;
    user-select: none;
}

.st-upload-label strong {
    color: var(--neon-green);
    font-weight: 600;
}

#st-file-input {
    display: none;
}

/* Error text */
.st-error {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: -16px;
    margin-bottom: 16px;
    min-height: 20px;
}

/* Thumbnail grid */
.st-thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 28px;
}

.st-thumb-grid:empty {
    display: none;
}

.st-thumb {
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    position: relative;
}

.st-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.st-thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
    padding: 0;
}

.st-thumb-remove:hover {
    background: rgba(239,68,68,0.85);
}

/* Style name input */
.st-field {
    margin-bottom: 24px;
}

.st-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.st-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-white);
    font-size: 1rem;
    font-family: inherit;
    padding: 12px 16px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-sizing: border-box;
}

.st-input:focus {
    border-color: var(--neon-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.st-input::placeholder {
    color: var(--text-muted);
}

/* Custom themed select */
.st-select {
    position: relative;
}

.st-input-native {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.st-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background:
        linear-gradient(180deg, rgba(16, 185, 129, 0.11), rgba(16, 185, 129, 0.04)),
        rgba(9, 14, 24, 0.72);
    border: 1px solid rgba(16, 185, 129, 0.32);
    border-radius: var(--radius-sm);
    color: var(--text-white);
    font-size: 1rem;
    font-family: inherit;
    padding: 12px 16px;
    box-sizing: border-box;
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.03),
        0 8px 24px rgba(6, 24, 18, 0.28);
}

.st-select-trigger:hover {
    border-color: rgba(16, 185, 129, 0.42);
    background:
        linear-gradient(180deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.05)),
        rgba(255,255,255,0.05);
}

.st-select-trigger:focus {
    outline: none;
    border-color: var(--neon-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15), 0 8px 24px rgba(6, 24, 18, 0.28);
}

.st-select-arrow {
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--neon-green);
    border-bottom: 2px solid var(--neon-green);
    transform: rotate(45deg) translateY(-2px);
    transition: transform var(--transition-fast);
    flex: 0 0 auto;
    margin-right: 4px;
}

.st-select.open .st-select-arrow {
    transform: rotate(-135deg) translateY(-1px);
}

.st-select-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(8, 18, 30, 0.98), rgba(6, 14, 24, 0.98));
    border: 1px solid rgba(16, 185, 129, 0.28);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(16, 185, 129, 0.08) inset;
    padding: 8px;
    display: none;
    z-index: 30;
    backdrop-filter: blur(16px);
}

.st-select.open .st-select-menu {
    display: block;
}

.st-select-option {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-white);
    padding: 12px 14px;
    border-radius: 12px;
    font: inherit;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.st-select-option:hover,
.st-select-option:focus {
    outline: none;
    background: rgba(16, 185, 129, 0.12);
    color: #d1fae5;
}

.st-select-option.is-selected {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(34, 197, 94, 0.14));
    color: #ecfdf5;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.24);
}

/* Submit button */
.st-submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--neon-green) 0%, var(--accent-green) 100%);
    color: #020617;
    font-family: 'Unbounded', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.st-submit-btn:hover:not(:disabled) {
    opacity: 0.92;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}

.st-submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Progress/status states */
.st-progress-wrap {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 48px 24px;
    gap: 24px;
}

.st-progress-wrap.active {
    display: flex;
}

.st-progress-title {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    font-weight: 700;
    color: var(--neon-green);
    letter-spacing: -0.3px;
}

.st-progress-dots::after {
    content: '';
    display: inline-block;
    animation: st-dots 1.4s steps(4,end) infinite;
}

@keyframes st-dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
}

.st-progress-bar-wrap {
    width: 100%;
    max-width: 400px;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 99px;
    overflow: hidden;
}

.st-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-green), var(--accent-green));
    border-radius: 99px;
    transition: width 1s ease;
    width: 5%;
}

.st-progress-eta {
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Spinner */
.st-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(16,185,129,0.2);
    border-top-color: var(--neon-green);
    border-radius: 50%;
    animation: st-spin 0.8s linear infinite;
}

@keyframes st-spin {
    to { transform: rotate(360deg); }
}

/* Completed state */
.st-complete-wrap {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 24px;
    gap: 20px;
}

.st-complete-wrap.active {
    display: flex;
}

.st-complete-title {
    font-family: 'Unbounded', sans-serif;
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 700;
    color: var(--neon-green);
}

.st-complete-check {
    width: 64px;
    height: 64px;
    stroke: var(--neon-green);
}

.st-complete-box {
    background: rgba(16, 185, 129, 0.07);
    border: 1px solid rgba(16, 185, 129, 0.28);
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.7;
    max-width: 480px;
    width: 100%;
}

.st-complete-box strong {
    color: var(--text-white);
}

.st-reset-btn {
    background: transparent;
    border: 1px solid var(--glass-border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.875rem;
    padding: 10px 20px;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

.st-reset-btn:hover {
    border-color: var(--neon-green);
    color: var(--neon-green);
}

/* Failed state */
.st-failed-title {
    font-family: 'Unbounded', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ef4444;
}

.st-failed-msg {
    color: var(--text-dim);
    font-size: 0.9rem;
    max-width: 400px;
}

/* Auth notice */
.st-auth-notice {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-dim);
}

.st-auth-notice a {
    color: var(--neon-green);
    text-decoration: none;
    font-weight: 600;
}

/* Image count badge */
.st-count-badge {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: block;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .st-progress-bar { transition: none; }
    .st-spinner { animation: none; }
    .st-progress-dots::after { animation: none; content: '...'; }
}

@media (max-width: 480px) {
    .st-page {
        padding: 88px 16px 48px;
    }

    .st-thumb-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}
