/* ==========================================================================
   HEICtoJPG Pro - CSS Stylesheet
   Design System: Premium Glassmorphic Dark Mode
   ========================================================================== */

/* Variables & Token definitions */
:root {
    --font-primary: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;

    /* Theme HSL Colors */
    --color-bg-h: 230;
    --color-bg-s: 25%;
    --color-bg-l: 6%;
    --color-bg: hsl(var(--color-bg-h), var(--color-bg-s), var(--color-bg-l));
    
    --color-panel-h: 230;
    --color-panel-s: 25%;
    --color-panel-l: 10%;
    --color-panel: hsla(var(--color-panel-h), var(--color-panel-s), var(--color-panel-l), 0.65);
    
    --color-card-h: 230;
    --color-card-s: 25%;
    --color-card-l: 14%;
    --color-card: hsla(var(--color-card-h), var(--color-card-s), var(--color-card-l), 0.5);

    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-glow: rgba(124, 58, 237, 0.3);

    /* Text Colors */
    --text-primary: hsl(0, 0%, 94%);
    --text-secondary: hsl(var(--color-bg-h), 12%, 70%);
    --text-muted: hsl(var(--color-bg-h), 10%, 50%);

    /* Accents (Purple-Indigo) */
    --color-primary: hsl(263, 70%, 50%);
    --color-primary-glow: hsl(263, 80%, 65%);
    --color-primary-light: hsla(263, 70%, 50%, 0.15);

    /* Success (Turquoise/Teal) */
    --color-success: hsl(174, 75%, 45%);
    --color-success-glow: hsl(174, 85%, 55%);
    --color-success-light: hsla(174, 75%, 45%, 0.15);

    /* Danger/Warning */
    --color-danger: hsl(355, 78%, 56%);
    --color-danger-light: hsla(355, 78%, 56%, 0.15);

    /* Shadows & Blurs */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.25);
    --blur-panel: blur(16px);
    --blur-card: blur(8px);
    
    /* Layout */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-round: 9999px;
    
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    width: 100%;
    min-height: 100vh;
    background-color: var(--color-bg);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 15px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Elegant Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-round);
    border: 2px solid var(--color-bg);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Decorative Background Elements
   ========================================================================== */
.app-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.glow-spot {
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.15;
    pointer-events: none;
    z-index: -1;
}
.glow-spot-1 {
    background: var(--color-primary);
    top: -10%;
    left: -5%;
}
.glow-spot-2 {
    background: var(--color-success);
    bottom: -10%;
    right: -5%;
}

/* ==========================================================================
   Glassmorphic Framework Utility
   ========================================================================== */
.glass {
    background: var(--color-panel);
    backdrop-filter: var(--blur-panel);
    -webkit-backdrop-filter: var(--blur-panel);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: border var(--transition-fast), box-shadow var(--transition-fast);
}

/* ==========================================================================
   Header Styles
   ========================================================================== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 40px;
    border-bottom: 1px solid var(--color-border);
    background: rgba(12, 13, 18, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-glow));
    border-radius: var(--radius-md);
    color: white;
    box-shadow: var(--shadow-glow);
}
.logo-icon i {
    width: 24px;
    height: 24px;
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    background: linear-gradient(to right, var(--text-primary), #d8b4fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-text p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Pulsing Badge */
.badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--color-primary-light);
    color: var(--color-primary-glow);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(124, 58, 237, 0.2);
    letter-spacing: 0.5px;
    font-family: var(--font-primary);
}

.badge-secondary {
    font-size: 11px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.badge-value {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 12px;
    background: var(--color-primary-light);
    color: var(--color-primary-glow);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 6px 14px;
    border-radius: var(--radius-round);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--color-success);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.7);
    animation: pulse 1.6s infinite;
}

.status-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-success-glow);
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(20, 184, 166, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(20, 184, 166, 0);
    }
}

/* ==========================================================================
   Main Grid Layout
   ========================================================================== */
.app-main {
    flex: 1;
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 30px;
    padding: 40px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   Control Panel Sidebar Styles
   ========================================================================== */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 30px;
    height: fit-content;
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 10px;
}
.section-title i {
    width: 18px;
    height: 18px;
    color: var(--color-primary-glow);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.label-with-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-help {
    font-size: 11px;
    color: var(--text-muted);
}

/* Custom Dropdown Selection */
.select-wrapper {
    position: relative;
    width: 100%;
}

select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 12px 16px;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 500;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Custom Slider Styles */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-round);
    outline: none;
    cursor: pointer;
    margin: 10px 0;
}
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    border-radius: var(--radius-round);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary-glow), var(--color-primary));
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
    margin-top: -6px;
    transition: transform var(--transition-fast), background var(--transition-fast);
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* Session Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Control Panel Actions */
.panel-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

/* ==========================================================================
   Button Styles
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}
.btn:active {
    transform: scale(0.98);
}
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), hsl(263, 75%, 45%));
    color: white;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}
.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--color-primary-glow), var(--color-primary));
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--text-primary);
}
.btn-outline:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-success), hsl(174, 80%, 40%));
    color: white;
    box-shadow: 0 4px 14px rgba(20, 184, 166, 0.3);
}
.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--color-success-glow), var(--color-success));
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.4);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}
.btn-danger:hover:not(:disabled) {
    background: hsl(355, 88%, 62%);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    color: var(--text-secondary);
}
.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}
.btn-icon i {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Workspace Styles (Drag & Drop Zone, etc.)
   ========================================================================== */
.workspace {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.dropzone {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    background: rgba(12, 13, 18, 0.2);
    overflow: hidden;
}
.dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(124, 58, 237, 0.04) 0%, transparent 70%);
    z-index: 0;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--color-primary-glow);
    box-shadow: var(--shadow-glow);
    background: rgba(124, 58, 237, 0.02);
}

.hidden-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.dropzone-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    pointer-events: none;
}

.dropzone-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    color: var(--text-secondary);
    transition: transform var(--transition-smooth), color var(--transition-fast), border-color var(--transition-fast);
}
.dropzone:hover .dropzone-icon, .dropzone.dragover .dropzone-icon {
    transform: translateY(-4px);
    color: var(--color-primary-glow);
    border-color: var(--color-border-glow);
    background: var(--color-primary-light);
}
.dropzone-icon i {
    width: 32px;
    height: 32px;
}

.dropzone-content h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
}

.dropzone-content p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ==========================================================================
   Global Batch Progress Card Styles
   ========================================================================== */
.global-progress-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-text-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.progress-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-details {
    font-size: 12px;
    color: var(--text-secondary);
}

.progress-percentage {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary-glow);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-round);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--color-primary), var(--color-primary-glow));
    border-radius: var(--radius-round);
    width: 0;
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.5);
    transition: width 0.3s ease;
}

/* ==========================================================================
   Queue Container Styles
   ========================================================================== */
.queue-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.queue-header h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.queue-header h2 span {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    color: var(--text-secondary);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    color: var(--text-muted);
    text-align: center;
    background: rgba(255, 255, 255, 0.01);
}

.empty-icon {
    width: 48px;
    height: 48px;
    stroke-width: 1.5px;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.empty-state span {
    font-size: 12px;
    max-width: 320px;
}

/* ==========================================================================
   File Queue List & Queue Card Items
   ========================================================================== */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--color-border);
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.queue-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Media/Thumbnail Container */
.preview-container {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.preview-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: fadeIn 0.3s ease;
}

.preview-container i {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
}

/* Card Metadata Info */
.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* Ensures text truncation works */
}

.item-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.divider-dot {
    width: 3px;
    height: 3px;
    background: var(--text-muted);
    border-radius: 50%;
}

.saved-ratio {
    font-weight: 600;
    color: var(--color-success-glow);
}

/* Individual Status State Elements */
.item-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    color: var(--text-secondary);
}

.status-converting {
    background: var(--color-primary-light);
    border: 1px solid rgba(124, 58, 237, 0.2);
    color: var(--color-primary-glow);
}

.status-completed {
    background: var(--color-success-light);
    border: 1px solid rgba(20, 184, 166, 0.2);
    color: var(--color-success-glow);
}

.status-failed {
    background: var(--color-danger-light);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--color-danger);
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Spinner Loader Animation */
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Footer Styles
   ========================================================================== */
.app-footer {
    text-align: center;
    padding: 30px;
    border-top: 1px solid var(--color-border);
    color: var(--text-muted);
    font-size: 12px;
    margin-top: auto;
}

/* ==========================================================================
   CSS Transitions & Animations
   ========================================================================== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ==========================================================================
   Responsive Media Queries
   ========================================================================== */
@media (max-width: 1024px) {
    .app-main {
        grid-template-columns: 1fr;
        padding: 24px;
        gap: 24px;
    }
    
    .control-panel {
        height: auto;
    }
}

@media (max-width: 640px) {
    .app-header {
        padding: 16px 20px;
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
    
    .app-main {
        padding: 16px;
    }
    
    .queue-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .preview-container {
        width: 100%;
        height: 120px;
    }
    
    .item-actions {
        justify-content: flex-end;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
