/* ============================================
   WebP to AVIF Converter
   Prefix: wta-
   Brand accent: #3399cc (--color-2)
   Load order: custom_styles.css FIRST, then this file
   ============================================ */

:root {
    --wta-accent: #3399cc;
    --wta-accent-dark: #2277aa;
    --wta-accent-alpha: rgba(51, 153, 204, 0.12);
}

/* ============================================
   LAYOUT
   ============================================ */

.tool-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

/* ============================================
   HEADER
   ============================================ */

.tool-header {
    text-align: center;
    margin-bottom: 32px;
}

.tool-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 14px;
}

.tool-icon-wrapper {
    width: 52px;
    height: 52px;
    background: var(--wta-accent);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.tool-icon-wrapper svg {
    width: 26px;
    height: 26px;
}

.tool-title {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.tool-description {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.65;
}

.tool-description a {
    color: var(--wta-accent);
    text-decoration: none;
}

.tool-description a:hover {
    text-decoration: underline;
}

/* ============================================
   UPLOAD AREA
   ============================================ */

.upload-section {
    margin-bottom: 24px;
}

.upload-area {
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 52px 30px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.25s, background 0.25s;
    position: relative;
}

.upload-area:hover {
    border-color: var(--wta-accent);
    background: var(--wta-accent-alpha);
}

.upload-area.dragover {
    border-color: var(--wta-accent);
    background: var(--wta-accent-alpha);
}

.upload-icon {
    color: var(--wta-accent);
    margin-bottom: 18px;
}

.upload-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.upload-subtitle {
    color: var(--text-muted);
    margin: 0 0 18px;
    font-size: 0.95rem;
}

.upload-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.83rem;
    color: var(--text-light);
    background: var(--card-secondary);
    padding: 7px 14px;
    border-radius: 20px;
}

/* ============================================
   EDITOR SECTION
   ============================================ */

.editor-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: visible !important;
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--card-secondary);
    border-bottom: 1px solid var(--border-color);
    border-radius: 16px 16px 0 0;
}

.files-header-left {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 600;
    color: var(--text-primary);
}

.files-header-left svg {
    color: var(--wta-accent);
}

.wta-btn-text {
    background: none;
    border: none;
    color: var(--wta-accent);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.wta-btn-text:hover {
    background: var(--wta-accent-alpha);
}

/* ============================================
   FILES LIST
   ============================================ */

.files-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 14px 18px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px;
    background: var(--card-secondary);
    border-radius: 10px;
    margin-bottom: 9px;
    transition: background 0.2s;
}

.file-item:hover {
    background: var(--card-tertiary);
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-preview {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
    font-size: 0.95rem;
}

.file-meta {
    display: flex;
    gap: 12px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.file-remove {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.file-remove:hover {
    background: var(--error-bg);
    color: var(--error-color);
}

/* ============================================
   SETTINGS PANEL
   ============================================ */

.settings-panel {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.panel-header {
    margin-bottom: 18px;
}

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.panel-header h3 svg {
    color: var(--wta-accent);
}

.quality-section {
    margin-bottom: 20px;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 0.92rem;
}

.section-label svg {
    color: var(--wta-accent);
}

.quality-slider-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.slider-input {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 7px;
    background: var(--card-secondary);
    border-radius: 4px;
    outline: none;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--wta-accent);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(51, 153, 204, 0.4);
    transition: transform 0.2s;
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--wta-accent);
    cursor: pointer;
    border: none;
}

.slider-input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.quality-value-display {
    min-width: 58px;
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--wta-accent);
    background: var(--wta-accent-alpha);
    padding: 5px 10px;
    border-radius: 8px;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 7px;
}

.quality-presets {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.preset-label {
    font-size: 0.83rem;
    color: var(--text-muted);
    font-weight: 500;
}

.preset-btn {
    padding: 5px 13px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.83rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.preset-btn:hover {
    border-color: var(--wta-accent);
    color: var(--wta-accent);
}

.preset-btn.active {
    background: var(--wta-accent);
    border-color: var(--wta-accent);
    color: #fff;
}

/* ============================================
   OPTIONS GRID
   ============================================ */

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.option-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 7px;
    font-size: 0.9rem;
}

.option-group label svg {
    color: var(--wta-accent);
}

.styled-dropdown {
    width: 100%;
    padding: 9px 34px 9px 11px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.92rem;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233399cc' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 15px;
}

.styled-dropdown:hover,
.styled-dropdown:focus {
    border-color: var(--wta-accent);
    outline: none;
}

/* Checkbox - scoped override of custom_styles.css */
.wta-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 9px;
}

.wta-checkbox-wrapper input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    accent-color: var(--wta-accent) !important;
    cursor: pointer;
    margin-right: 0 !important;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-elevated) !important;
    flex-shrink: 0;
}

.wta-checkbox-label {
    color: var(--text-primary);
    font-size: 0.92rem;
    cursor: pointer;
}

.quality-info {
    display: flex;
    gap: 11px;
    padding: 13px 15px;
    background: var(--wta-accent-alpha);
    border-radius: 9px;
    margin-top: 14px;
}

.quality-info .info-icon {
    color: var(--wta-accent);
    flex-shrink: 0;
    margin-top: 1px;
}

.quality-info .info-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* ============================================
   ACTION BAR
   ============================================ */

.action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 11px;
    padding: 18px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--card-secondary);
    border-radius: 0 0 16px 16px;
}

/* ============================================
   BUTTONS
   ============================================ */

.wta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 22px;
    border: none;
    border-radius: 9px;
    font-size: 0.97rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    text-decoration: none;
    line-height: 1;
}

.wta-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.wta-btn-primary {
    background: var(--wta-accent);
    color: #fff;
}

.wta-btn-secondary {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.wta-btn-secondary:hover {
    background: var(--card-secondary);
    color: var(--text-primary);
    opacity: 1;
    transform: none;
}

.wta-btn-success {
    background: var(--success-color);
    color: #fff;
}

/* ============================================
   RESULTS SECTION
   ============================================ */

.results-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
}

.results-header {
    margin-bottom: 28px;
}

.results-icon {
    width: 66px;
    height: 66px;
    background: var(--success-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin: 0 auto 18px;
}

.results-title {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.results-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0;
}

.converted-files-list {
    margin-bottom: 24px;
}

.converted-file-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--card-secondary);
    border-radius: 11px;
    margin-bottom: 9px;
    text-align: left;
}

.converted-file-preview {
    width: 58px;
    height: 58px;
    border-radius: 9px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.converted-file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.converted-file-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
    font-size: 0.92rem;
}

.converted-file-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.converted-file-savings {
    background: var(--success-bg);
    color: var(--success-color);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.78rem;
}

.converted-file-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: var(--wta-accent);
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.converted-file-download:hover {
    opacity: 0.85;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 13px;
    flex-wrap: wrap;
}

/* ============================================
   ERROR MESSAGE
   ============================================ */

.wta-error {
    background: var(--error-bg);
    color: var(--error-color);
    padding: 14px 18px;
    border-radius: 10px;
    margin-top: 18px;
    font-size: 0.93rem;
    line-height: 1.55;
}

.wta-error a {
    color: var(--error-color);
    font-weight: 600;
}

/* ============================================
   PROCESSING OVERLAY - Stage-based spinner
   ============================================ */

.wta-processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    backdrop-filter: blur(3px);
}

.wta-processing-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 36px 40px;
    text-align: center;
    min-width: 340px;
    max-width: 420px;
    width: 92%;
}

.wta-stages-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 10px;
}

.wta-stage-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.wta-stage-dot {
    width: 36px;
    height: 36px;
    background: var(--card-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 6px;
    transition: background 0.3s, color 0.3s;
}

.wta-stage-dot svg {
    width: 18px;
    height: 18px;
}

.wta-stage-dot.active {
    background: var(--wta-accent);
    color: #fff;
}

.wta-stage-dot.done {
    background: var(--success-color);
    color: #fff;
}

.wta-stage-label {
    font-size: 0.74rem;
    color: var(--text-light);
    white-space: nowrap;
}

.wta-stage-item .wta-stage-dot.active + .wta-stage-label,
.wta-stage-item .wta-stage-dot.done + .wta-stage-label {
    color: var(--text-secondary);
}

.wta-stage-connector {
    width: 28px;
    height: 2px;
    background: var(--border-color);
    margin: 0 4px;
    margin-bottom: 22px;
    flex-shrink: 0;
}

.wta-processing-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0 6px;
}

.wta-progress-bar {
    height: 8px;
    background: var(--card-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin: 14px 0 8px;
}

.wta-progress-fill {
    height: 100%;
    background: var(--wta-accent);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

.wta-progress-pct {
    font-weight: 700;
    font-size: 1rem;
    color: var(--wta-accent);
    margin: 0 0 6px;
}

.wta-status-msg {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0;
    min-height: 1.4em;
}

/* ============================================
   BROWSER SUPPORT NOTICE
   ============================================ */

.wta-browser-support {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 11px 18px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin: 22px 0;
    font-size: 0.87rem;
    color: var(--text-muted);
}

.wta-browser-support svg {
    color: var(--wta-accent);
    flex-shrink: 0;
}

/* ============================================
   RELATED TOOLS
   ============================================ */

.related-tools {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 18px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 28px;
}

.related-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.92rem;
    white-space: nowrap;
}

.related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.related-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    background: var(--card-secondary);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.87rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.related-link:hover {
    background: var(--wta-accent);
    color: #fff;
}

/* ============================================
   INFO SECTIONS
   ============================================ */

.info-sections {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.info-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px 28px;
}

.info-card h2 {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 18px;
}

.info-card h2 svg {
    color: var(--wta-accent);
}

/* Steps list */
.steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: wta-step;
}

.steps-list li {
    position: relative;
    padding-left: 48px;
    margin-bottom: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
    counter-increment: wta-step;
    font-size: 0.95rem;
}

.steps-list li::before {
    content: counter(wta-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    background: var(--wta-accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.steps-list li:last-child {
    margin-bottom: 0;
}

/* Format / Mode explanations */
.format-explanations,
.mode-explanations {
    display: grid;
    gap: 13px;
}

.format-explain,
.mode-explain {
    display: flex;
    gap: 13px;
    padding: 13px;
    background: var(--card-secondary);
    border-radius: 9px;
}

.format-tag,
.mode-tag {
    flex-shrink: 0;
    padding: 5px 11px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    height: fit-content;
}

.format-tag.webp {
    background: rgba(51, 153, 204, 0.12);
    color: var(--wta-accent);
}

.format-tag.avif {
    background: rgba(51, 153, 204, 0.2);
    color: var(--wta-accent-dark);
}

[data-theme="dark"] .format-tag.avif {
    color: var(--wta-accent);
}

.mode-tag.high {
    background: var(--success-bg);
    color: var(--success-color);
}

.mode-tag.medium {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.mode-tag.low {
    background: var(--error-bg);
    color: var(--error-color);
}

.format-explain p,
.mode-explain p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.92rem;
}

/* Tip note */
.tip-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 18px;
    padding: 12px 14px;
    background: var(--wta-accent-alpha);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tip-note svg {
    color: var(--wta-accent);
    flex-shrink: 0;
    margin-top: 1px;
}

.tip-note a {
    color: var(--wta-accent);
    text-decoration: none;
}

.tip-note a:hover {
    text-decoration: underline;
}

/* ============================================
   FAQ
   ============================================ */

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.faq-item {
    background: var(--card-secondary);
    border-radius: 10px;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.97rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
    gap: 12px;
}

.faq-question:hover {
    background: var(--card-tertiary);
}

.faq-question svg {
    color: var(--wta-accent);
    transition: transform 0.3s;
    flex-shrink: 0;
}

.faq-item.open .faq-question svg {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer {
    max-height: 500px;
}

.faq-answer p {
    padding: 0 18px 18px;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.93rem;
}

.faq-answer a {
    color: var(--wta-accent);
    text-decoration: none;
}

.faq-answer a:hover {
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .tool-title { font-size: 1.55rem; }
    .tool-description { font-size: 0.97rem; }
    .upload-area { padding: 36px 20px; }
    .upload-title { font-size: 1.2rem; }

    .files-header { flex-direction: column; gap: 9px; text-align: center; }
    .options-grid { grid-template-columns: 1fr; }
    .action-bar { flex-direction: column; }
    .wta-btn { width: 100%; }

    .related-tools { flex-direction: column; align-items: flex-start; }
    .related-links { width: 100%; }
    .related-link { flex: 1; min-width: calc(50% - 4px); justify-content: center; }

    .info-card { padding: 18px 16px; }
    .format-explain, .mode-explain { flex-direction: column; gap: 8px; }
    .converted-file-item { flex-direction: column; text-align: center; }
    .converted-file-download { width: 100%; justify-content: center; }
    .results-actions { flex-direction: column; }
    .results-actions .wta-btn { width: 100%; }

    .wta-processing-card { padding: 28px 22px; min-width: 0; }
}

@media (max-width: 480px) {
    .tool-title-row { flex-direction: column; gap: 9px; }
    .quality-presets { justify-content: center; }
    .preset-label { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    .wta-btn, .related-link, .faq-question svg,
    .wta-progress-fill, .wta-stage-dot { transition: none; }
}
