/* ============================================================
   Neon Image Converter PRO — Style Sheet
   Design System: Neon Dark (matches Audio Trimmer PRO)
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --bg-color: #0a0a0a;
    --surface-color: #141414;
    --surface-light: #222;
    --primary-color: #a3ff00;
    --primary-glow: rgba(163, 255, 0, 0.4);
    --danger-color: #ff4444;
    --text-color: #ffffff;
    --text-muted: #888899;
    --border-color: #333;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 2rem;
    min-height: 100vh;
    background-image: radial-gradient(
        circle at 50% 0%,
        rgba(163, 255, 0, 0.08) 0%,
        transparent 70%
    );
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- App Container --- */
.app-container {
    width: 100%;
    max-width: 1400px;
    padding: 2.5rem;
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 32px;
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.8),
        inset 0 0 0 1px rgba(163, 255, 0, 0.1);
    margin: 2rem;
}

/* --- Header --- */
header {
    text-align: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.badge {
    font-size: 1rem;
    background: var(--primary-color);
    color: var(--bg-color);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    text-transform: uppercase;
    font-weight: 800;
    box-shadow: 0 0 15px var(--primary-glow);
    line-height: 1.4;
}

.highlight {
    color: var(--primary-color);
    text-shadow: 0 0 20px var(--primary-glow);
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 300;
    margin-top: 0.4rem;
}

/* --- Drop Zone --- */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    padding: 5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(163, 255, 0, 0.05);
    box-shadow: 0 0 40px rgba(163, 255, 0, 0.1) inset;
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    pointer-events: none;
}

.drop-content p {
    font-size: 1.2rem;
    font-weight: 600;
}

.drop-content svg {
    color: var(--primary-color);
    filter: drop-shadow(0 0 15px var(--primary-glow));
    transition: var(--transition);
}

.drop-zone:hover .drop-content svg {
    transform: translateY(-10px) scale(1.1);
}

.drop-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* --- Utility: Hidden --- */
.hidden {
    display: none !important;
}

/* --- Editor Layout --- */
.editor {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    position: relative;
    align-items: flex-start;
    animation: fadeIn 0.4s ease;
}

/* --- Sidebar --- */
.sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--surface-color);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 700px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.8rem;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-actions {
    display: flex;
    gap: 0.4rem;
}

.count-badge {
    font-size: 0.75rem;
    background: var(--primary-color);
    color: var(--bg-color);
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-weight: 800;
    min-width: 24px;
    text-align: center;
    display: inline-block;
    line-height: 1.4;
}

/* --- Buttons --- */
.btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-color);
    outline: none;
    font-family: 'Outfit', sans-serif;
}

.btn-small {
    padding: 0.4rem;
    border-radius: 8px;
    background: var(--surface-light);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-family: 'Outfit', sans-serif;
}

.btn-small:hover {
    background: var(--primary-color);
    color: var(--bg-color);
}

.btn-danger-subtle {
    color: var(--danger-color);
}

.btn-danger-subtle:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

/* --- File List --- */
.file-list {
    list-style: none;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 0.5rem;
    flex-grow: 1;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.file-list::-webkit-scrollbar {
    width: 6px;
}

.file-list::-webkit-scrollbar-track {
    background: transparent;
}

.file-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.file-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Firefox scrollbar */
.file-list {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* --- File Item --- */
.file-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface-light);
    border: 1px solid transparent;
    position: relative;
    animation: fileItemIn 0.3s ease both;
}

.file-item:hover {
    border-color: rgba(163, 255, 0, 0.3);
}

.file-item.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(163, 255, 0, 0.1);
}

.file-item.selected {
    opacity: 0.5;
}

.file-item.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    right: 0.6rem;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-weight: 800;
    font-size: 1rem;
    text-shadow: 0 0 8px var(--primary-glow);
}

/* --- File Item Checkbox --- */
.file-item input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
    background: transparent;
}

.file-item input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
}

.file-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 5px;
    width: 4px;
    height: 9px;
    border: solid var(--bg-color);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* --- Thumbnail in File List --- */
.file-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* --- File Info in Sidebar --- */
.file-details {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
    font-weight: 500;
    display: block;
}

.file-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.format-tag {
    font-size: 0.6rem;
    background: rgba(163, 255, 0, 0.15);
    color: var(--primary-color);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    line-height: 1.4;
}

/* --- Delete Button --- */
.btn-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
    flex-shrink: 0;
    opacity: 0;
    font-family: 'Outfit', sans-serif;
}

.file-item:hover .btn-delete {
    opacity: 1;
}

.btn-delete:hover {
    color: var(--danger-color);
    background: rgba(255, 68, 68, 0.1);
}

/* --- Sidebar Footer --- */
.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 0.8rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
}

/* --- Main Editor --- */
.main-editor {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

/* --- Preview Container --- */
.preview-container {
    background: var(--surface-light);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    position: relative;
    box-shadow: inset 0 5px 15px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preview-wrapper {
    width: 100%;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 12px;
    background:
        repeating-conic-gradient(
            rgba(255, 255, 255, 0.03) 0% 25%,
            transparent 0% 50%
        ) 50% / 20px 20px;
}

#image-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
    border-radius: 4px;
    image-rendering: auto;
}

.preview-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.image-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.info-text {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.info-text svg {
    opacity: 0.6;
}

/* Format tag – larger variant in preview bar */
.preview-bar .format-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
}

/* --- Zoom Panel --- */
.zoom-panel {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-muted);
}

.zoom-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 40px;
    text-align: right;
}

/* --- Pro Slider (shared pattern with Audio Trimmer) --- */
.pro-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent;
    height: 4px;
    width: 120px;
    cursor: pointer;
}

.pro-slider:focus {
    outline: none;
}

/* WebKit Track */
.pro-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
}

/* WebKit Thumb */
.pro-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 10px var(--primary-glow);
    border: none;
    transition: box-shadow 0.2s ease;
}

.pro-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 18px var(--primary-glow);
}

/* Firefox Track */
.pro-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    border: none;
}

/* Firefox Thumb */
.pro-slider::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
    border: none;
}

.pro-slider::-moz-range-thumb:hover {
    box-shadow: 0 0 18px var(--primary-glow);
}

/* --- Conversion Panel --- */
.conversion-panel {
    background: var(--surface-color);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.conversion-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.pro-col {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.pro-col > label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.slider-header span {
    color: var(--primary-color);
}

/* --- Pro Select --- */
.pro-select {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888899' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2.2rem;
}

.pro-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(163, 255, 0, 0.15);
}

.pro-select option {
    background: var(--surface-color);
    color: var(--text-color);
}

/* --- Resize Custom Row --- */
.resize-custom {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    justify-content: center;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-light);
    padding: 0.5rem 0.8rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(163, 255, 0, 0.1);
}

.input-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    user-select: none;
}

.size-input {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    width: 70px;
    outline: none;
    font-variant-numeric: tabular-nums;
}

.size-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* --- Lock Aspect Ratio Button --- */
.btn-lock {
    padding: 0.5rem;
    border-radius: 10px;
    background: var(--surface-light);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
}

.btn-lock.active {
    color: var(--primary-color);
    border-color: rgba(163, 255, 0, 0.3);
    box-shadow: 0 0 8px rgba(163, 255, 0, 0.1);
}

.btn-lock:hover {
    background: rgba(163, 255, 0, 0.1);
}

/* --- ZIP Toggle --- */
.zip-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: var(--transition);
    user-select: none;
    white-space: nowrap;
}

.zip-toggle:hover {
    border-color: rgba(163, 255, 0, 0.3);
    color: var(--text-color);
}

.zip-toggle input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
    background: transparent;
}

.zip-toggle input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 8px var(--primary-glow);
}

.zip-toggle input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 0px;
    left: 4px;
    width: 4px;
    height: 8px;
    border: solid var(--bg-color);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.zip-toggle:has(input:checked) {
    border-color: rgba(163, 255, 0, 0.3);
    color: var(--primary-color);
    background: rgba(163, 255, 0, 0.05);
}

/* --- Export Actions --- */
.export-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-color);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    gap: 0.5rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 15px rgba(163, 255, 0, 0.1);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--bg-color);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.9rem;
    gap: 0.5rem;
    box-shadow: 0 0 20px var(--primary-glow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-family: 'Outfit', sans-serif;
}

.btn-primary:hover {
    box-shadow: 0 0 35px var(--primary-glow);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* --- Progress Bar --- */
.progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
}

.progress-info span:first-child {
    color: var(--text-muted);
}

.progress-info span:last-child {
    color: var(--primary-color);
}

.progress-track {
    width: 100%;
    height: 6px;
    background: var(--surface-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), #c8ff50);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* --- Loading Overlay --- */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin-bottom: 1.5rem;
    box-shadow: 0 0 20px var(--primary-glow);
}

#loading-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-glow);
}

/* --- Keyframe Animations --- */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fileItemIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --- Responsive: Tablets & Small Desktops --- */
@media (max-width: 1100px) {
    .editor {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 280px;
    }

    .conversion-options {
        grid-template-columns: 1fr;
    }

    .export-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .preview-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 600px) {
    .app-container {
        padding: 1.2rem;
        border-radius: 20px;
        margin: 1rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .preview-wrapper {
        height: 250px;
    }

    .drop-zone {
        padding: 3rem 1.2rem;
    }

    .resize-custom {
        flex-direction: column;
        gap: 0.8rem;
    }

    .zoom-panel {
        width: 100%;
    }

    .pro-slider {
        width: 100%;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}
