* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; padding: 20px; }
.container { max-width: 1200px; margin: 0 auto; background: #fff; border-radius: 20px; box-shadow: 0 20px 40px rgba(0,0,0,0.1); overflow: hidden; }
.header { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); color: #fff; padding: 30px; text-align: center; }
.header h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 10px; }
.header p { font-size: 1.1rem; opacity: 0.9; }
.main-content { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 30px; padding: 30px; min-height: 600px; }
.mode-panel, .control-panel { background: #f8fafc; border-radius: 15px; padding: 25px; height: fit-content; }
.mode-panel h3, .control-panel h3 { color: #1e293b; margin-bottom: 20px; font-size: 1.3rem; font-weight: 600; }
.mode-buttons { display: grid; gap: 12px; }
.mode-btn { background: #fff; border: 2px solid #e2e8f0; border-radius: 12px; padding: 15px; cursor: pointer; transition: all .3s ease; text-align: center; font-weight: 500; color: #475569; }
.mode-btn:hover { border-color: #4f46e5; background: #f0f9ff; transform: translateY(-2px); }
.mode-btn.active { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); color: #fff; border-color: #4f46e5; box-shadow: 0 4px 12px rgba(79,70,229,.3); }
.preview-area { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f1f5f9; border-radius: 20px; border: 3px dashed #cbd5e1; position: relative; min-height: 500px; transition: all .3s ease; }
.preview-area.has-image { border-color: #4f46e5; background: #fff; }
.upload-zone { text-align: center; padding: 40px; cursor: pointer; transition: all .3s ease; }
.upload-zone:hover { transform: scale(1.02); }
.upload-icon { font-size: 4rem; color: #94a3b8; margin-bottom: 20px; }
.upload-text { color: #64748b; font-size: 1.2rem; margin-bottom: 10px; }
.upload-hint { color: #94a3b8; font-size: .9rem; }
.canvas-container { position: relative; display: none; width: 100%; height: 100%; padding: 20px; }
.canvas-container.active { display: block; }
#previewCanvas { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 10px 25px rgba(0,0,0,.1); cursor: crosshair; }
.grid-overlay { position: absolute; top: 20px; left: 20px; right: 20px; bottom: 20px; pointer-events: none; border-radius: 10px; overflow: hidden; }
.grid-line { position: absolute; background: rgba(239,68,68,.8); z-index: 10; }
.grid-line.horizontal { height: 2px; left: 0; right: 0; }
.grid-line.vertical { width: 2px; top: 0; bottom: 0; }
.control-buttons { display: grid; gap: 12px; }
.btn { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); color: #fff; border: none; border-radius: 12px; padding: 15px 20px; cursor: pointer; font-size: 1rem; font-weight: 600; transition: all .3s ease; text-align: center; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(79,70,229,.3); }
.btn:active { transform: translateY(0); }
.btn-secondary { background: linear-gradient(135deg, #64748b 0%, #475569 100%); }
.btn-secondary:hover { box-shadow: 0 8px 20px rgba(100,116,139,.3); }
.quality-controls { margin-top: 25px; padding-top: 25px; border-top: 1px solid #e2e8f0; }
.quality-slider { width: 100%; margin: 10px 0; accent-color: #4f46e5; }
.slider-label { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: .9rem; color: #475569; }
.status { margin-top: 20px; padding: 15px; border-radius: 10px; font-size: .9rem; text-align: center; display: none; }
.status.success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.status.error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.status.info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.loading { display: none; text-align: center; padding: 20px; }
.loading.active { display: block; }
.spinner { border: 3px solid #f3f4f6; border-top: 3px solid #4f46e5; border-radius: 50%; width: 30px; height: 30px; animation: spin 1s linear infinite; margin: 0 auto 10px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.hidden { display: none !important; }
@media (max-width: 768px) { body { padding: 10px; } .main-content { grid-template-columns: 1fr; gap: 20px; padding: 20px; } .header { padding: 20px; } .header h1 { font-size: 2rem; } .mode-panel, .control-panel { order: 2; } .preview-area { order: 1; min-height: 400px; } .mode-buttons { grid-template-columns: repeat(2, 1fr); } .control-buttons { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .mode-buttons { grid-template-columns: 1fr; } .control-buttons { grid-template-columns: 1fr; } }
.dragging { border-color: #4f46e5 !important; background: #f0f9ff !important; }
.crop-area { position: absolute; border: 2px dashed #4f46e5; background: rgba(79,70,229,0.1); cursor: move; display: none; z-index: 20; }
.crop-handle { position: absolute; width: 12px; height: 12px; background: #4f46e5; border: 2px solid #fff; border-radius: 50%; cursor: pointer; z-index: 25; }
.crop-handle:hover { background: #7c3aed; transform: scale(1.2); }
.crop-handle.nw { top: -6px; left: -6px; cursor: nw-resize; }
.crop-handle.ne { top: -6px; right: -6px; cursor: ne-resize; }
.crop-handle.sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.crop-handle.se { bottom: -6px; right: -6px; cursor: se-resize; }
.crop-info { position: absolute; top: -30px; left: 0; background: #4f46e5; color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; z-index: 30; }
