:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
}

.app-header {
    text-align: center;
}

.app-header h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.app-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.main-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Upload Area & Preview */
.preview-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.upload-area {
    background: var(--glass-bg);
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.05);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.upload-area:hover .upload-icon {
    color: var(--accent);
    transform: translateY(-5px);
}

.upload-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.upload-subtext {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.image-preview-container {
    background: var(--glass-bg);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#originalPreview {
    max-width: 100%;
    max-height: 500px;
    border-radius: calc(var(--radius) - 4px);
    object-fit: contain;
    background: repeating-conic-gradient(#334155 0% 25%, #1e293b 0% 50%) 50% / 20px 20px;
}

.image-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

/* Settings Panel */
.glass-panel {
    background: var(--glass-bg);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.glass-panel h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.setting-group {
    margin-bottom: 1.5rem;
}

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

/* Inputs */
.dimensions-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-wrapper {
    position: relative;
    flex: 1;
}

input[type="number"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem;
    padding-right: 2.5rem;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.input-wrapper .unit {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
    pointer-events: none;
}

.aspect-ratio-btn {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.aspect-ratio-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.aspect-ratio-btn.active {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.aspect-ratio-btn svg {
    width: 20px;
    height: 20px;
}

/* Custom Select */
.custom-select select {
    appearance: none;
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.custom-select {
    position: relative;
}

.custom-select::after {
    content: '';
    position: absolute;
    right: 1rem;
    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;
}

.custom-select select:focus {
    border-color: var(--accent);
}

.custom-select select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Button */
.primary-btn {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    margin-top: 1rem;
}

.primary-btn svg {
    width: 20px;
    height: 20px;
}

.primary-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateY(-2px);
}

.primary-btn:disabled {
    background: #475569;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Status Message */
.status-message {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    min-height: 20px;
}

.status-message.success {
    color: #10b981;
}

.status-message.error {
    color: #ef4444;
}

.status-message.processing {
    color: var(--accent);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Sliders for WEBP Settings */
.slider-group {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    padding: 0.5rem;
    border-radius: 8px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.slider-header span:last-child {
    font-weight: 600;
    color: var(--accent);
}

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

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

.custom-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 10px var(--accent-glow);
    transform: scale(1.2);
}

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

.custom-slider::-moz-range-thumb:hover {
    box-shadow: 0 0 10px var(--accent-glow);
    transform: scale(1.2);
}


/* Cropper.js Customizations */
.cropper-view-box,
.cropper-face {
    border-radius: 4px;
}

.cropper-line {
    background-color: var(--accent);
}

.cropper-point {
    background-color: var(--accent);
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.cropper-point.point-se {
    width: 12px;
    height: 12px;
}

.cropper-center {
    display: none;
}

.cropper-modal {
    background-color: rgba(15, 23, 42, 0.8);
}

/* Info Section */
.info-section {
    margin-top: 1rem;
    padding: 2.5rem;
}

.info-section h3 {
    font-size: 1.3rem;
    color: var(--accent);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.info-section h3:first-child {
    margin-top: 0;
}

.info-section p, 
.info-section li {
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.info-section ul, 
.info-section ol {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Global Drag & Drop Overlay */
body.drag-over::after {
    content: "Drop image to load";
    position: fixed;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(5px);
    color: var(--accent);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 800;
    z-index: 9999;
    border: 4px dashed var(--accent);
    border-radius: var(--radius);
    pointer-events: none;
    box-shadow: inset 0 0 50px rgba(59, 130, 246, 0.2);
}
