/* CSS Reset & Variables */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-glow: rgba(79, 70, 229, 0.08);
    --success: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Background glow effects */
.glow-effect {
    position: absolute;
    top: -10%;
    left: 20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.05) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.app-header {
    border-bottom: 1px solid var(--border-color);
    padding: 18px 0;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.8);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo-icon {
    width: 26px;
    height: 26px;
    color: var(--accent);
}

.highlight {
    color: var(--accent);
}

.privacy-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(5, 150, 105, 0.08);
    border: 1px solid rgba(5, 150, 105, 0.15);
    color: var(--success);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-icon {
    width: 14px;
    height: 14px;
}

/* Main Layout */
.main-content {
    flex: 1;
    padding-top: 40px;
    padding-bottom: 60px;
}

.intro-section {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 40px;
}

.intro-section h1 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #1e293b 40%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-section p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.5;
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
    align-items: start;
}

/* Work Area & Dropzone */
.work-area {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.dropzone {
    border: 2px dashed rgba(79, 70, 229, 0.3);
    border-radius: var(--border-radius-lg);
    background-color: var(--bg-card);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    overflow: hidden;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background-color: rgba(79, 70, 229, 0.03);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.08);
    transform: translateY(-2px);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon-wrapper {
    width: 70px;
    height: 70px;
    background: rgba(79, 70, 229, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    transition: var(--transition);
}

.dropzone:hover .upload-icon-wrapper {
    background: rgba(79, 70, 229, 0.15);
    transform: scale(1.1);
}

.upload-icon {
    width: 32px;
    height: 32px;
    color: var(--accent);
}

.dropzone h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.dropzone p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.file-types {
    display: inline-block;
    background-color: rgba(0, 0, 0, 0.03);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Image Previews Grid */
.preview-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    animation: fadeIn 0.4s ease-out;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.preview-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.drag-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
}

/* Image Card */
.image-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 8px;
    position: relative;
    cursor: grab;
    transition: var(--transition);
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.image-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.image-card:active {
    cursor: grabbing;
}

.image-card.dragging {
    opacity: 0.4;
    border: 2px dashed var(--accent);
}

.image-wrapper {
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-metadata {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 0 2px;
}

.img-resolution {
    font-weight: 500;
}

.img-size {
    font-weight: 400;
}

.total-size-badge {
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 8px;
    vertical-align: middle;
}

.img-index {
    background: var(--accent);
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: bold;
}

.img-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 75px;
}

.btn-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: white;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.image-card:hover .btn-remove {
    opacity: 1;
}

.btn-remove:hover {
    background: var(--danger-hover);
    transform: scale(1.1);
}

.btn-remove svg {
    width: 12px;
    height: 12px;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

.btn-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    height: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover:not(:disabled) {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-action:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.btn-action svg {
    width: 14px;
    height: 14px;
}

/* Sidebar & Settings Panel */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

.settings-panel h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    color: var(--text-primary);
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

/* Styled Select */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    width: 100%;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    appearance: none;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.select-wrapper select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-secondary);
    pointer-events: none;
}

/* Styled Quality Slider */
.label-with-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.label-with-value label {
    margin-bottom: 0;
}

#quality-value {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
}

.slider {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.06);
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: var(--transition);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.4);
}

/* Live Preview Panel */
.live-preview-group {
    margin-top: 24px;
    margin-bottom: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.live-preview-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

.page-mockup-wrapper {
    background-color: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    padding: 10px;
}

.page-mockup {
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: width 0.3s ease, height 0.3s ease;
    display: flex;
    position: relative;
}

.page-mockup-margin {
    border: 1px dashed rgba(79, 70, 229, 0.3);
    width: 100%;
    height: 100%;
    transition: padding 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.page-mockup-image-fit {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.page-mockup-image {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #f1f5f9;
    transition: background-size 0.3s ease, width 0.3s ease, height 0.3s ease;
}

.preview-note {
    display: block;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 8px;
    text-align: center;
    font-style: italic;
}

/* Progress bar styles */
.progress-container {
    margin: 20px 0;
    animation: fadeIn 0.3s ease;
}

.progress-bar-wrapper {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 10px;
    transition: width 0.2s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    width: 100%;
}

.btn-icon {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}

.btn-primary:disabled {
    background-color: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.25);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: rgba(0, 0, 0, 0.06);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Info Panel */
.info-panel h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.steps-list {
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}

.steps-list li {
    margin-bottom: 8px;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 30px 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.app-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.app-footer a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.footer-support {
    margin-top: 6px;
}

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

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

/* Responsive design */
@media (max-width: 900px) {
    .app-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        order: unset;
    }
    
    .intro-section h1 {
        font-size: 2rem;
    }
}
