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

:root {
    --atw-accent:       #3399cc;
    --atw-accent-dark:  #2277aa;
    --atw-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(--atw-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(--atw-accent); text-decoration: none; }
.tool-description a:hover { text-decoration: underline; }

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

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

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

.upload-icon { color: var(--atw-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
   ============================================ */

.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(--atw-accent); }

.atw-btn-text {
    background: none;
    border: none;
    color: var(--atw-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;
}

.atw-btn-text:hover { background: var(--atw-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);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
}

.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(--atw-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(--atw-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(--atw-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(--atw-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(--atw-accent);
    background: var(--atw-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(--atw-accent); color: var(--atw-accent); }
.preset-btn.active { background: var(--atw-accent); border-color: var(--atw-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(--atw-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(--atw-accent); outline: none; }

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

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

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

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

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

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

.quality-info .info-text a { color: var(--atw-accent); text-decoration: none; }
.quality-info .info-text a:hover { text-decoration: underline; }

/* ============================================
   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
   ============================================ */

.atw-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;
}

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

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

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

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

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

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

.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-icon {
    width: 40px;
    height: 40px;
    background: var(--success-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success-color);
    flex-shrink: 0;
}

.converted-file-icon.error-icon {
    background: var(--error-bg);
    color: var(--error-color);
}

.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: 4px;
    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(--atw-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
   ============================================ */

.atw-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;
}

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

/* ============================================
   PROCESSING OVERLAY - stage spinner
   ============================================ */

.atw-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);
}

.atw-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%;
}

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

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

.atw-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;
}

.atw-stage-dot svg { width: 18px; height: 18px; }
.atw-stage-dot.active { background: var(--atw-accent); color: #fff; }
.atw-stage-dot.done   { background: var(--success-color); color: #fff; }

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

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

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

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

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

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

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

/* ============================================
   BROWSER SUPPORT - inside upload section
   ============================================ */

.atw-browser-support {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-size: 0.87rem;
    color: var(--text-muted);
}

.atw-browser-support svg { color: var(--atw-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(--atw-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(--atw-accent); }

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

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

.steps-list li::before {
    content: counter(atw-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    background: var(--atw-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; }
.steps-list a { color: var(--atw-accent); text-decoration: none; }
.steps-list a:hover { text-decoration: underline; }

/* Format / Mode explain */
.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.avif { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }
[data-theme="dark"] .format-tag.avif { background: rgba(167, 139, 250, 0.18); color: #a78bfa; }

.format-tag.webp { background: var(--atw-accent-alpha); color: var(--atw-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; }

.format-explain a,
.mode-explain a { color: var(--atw-accent); text-decoration: none; }
.format-explain a:hover,
.mode-explain a:hover { text-decoration: underline; }

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

.tip-note svg { color: var(--atw-accent); flex-shrink: 0; margin-top: 1px; }
.tip-note a { color: var(--atw-accent); text-decoration: none; }
.tip-note a:hover { text-decoration: underline; }

/* ============================================
   FAQ - uses .open class (global _footer.php handler)
   ============================================ */

.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(--atw-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(--atw-accent); text-decoration: none; }
.faq-answer a:hover { text-decoration: underline; }
.faq-answer code { background: var(--card-secondary); padding: 2px 5px; border-radius: 4px; font-size: 0.85em; }

/* ============================================
   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; }
    .options-grid { grid-template-columns: 1fr; }
    .action-bar { flex-direction: column; }
    .atw-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 .atw-btn { width: 100%; }
    .atw-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) {
    .atw-btn, .related-link, .faq-question svg, .atw-progress-fill, .atw-stage-dot { transition: none; }
}
