/* CSS Document */
:root { --primary: #007bff; --success: #28a745; --bg: #f0f2f5; --dark: #343a40; }
        body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; margin: 0; background: var(--bg); height: 100vh; overflow: hidden; }
        
        .app-container { display: flex; height: 100vh; }
        
        /* Sidebar */
        .sidebar { 
            width: 380px; background: white; border-right: 1px solid #ddd; 
            padding: 20px; overflow-y: auto; box-shadow: 2px 0 15px rgba(0,0,0,0.1);
            z-index: 10;
        }
        
        /* Main View */
        .main-view { 
            flex-grow: 1; display: flex; flex-direction: column; 
            align-items: center; justify-content: center; background: #e9ecef; padding: 20px;
            position: relative; overflow-y: auto;
        }

        #imageWrapper { position: relative; line-height: 0; box-shadow: 0 10px 40px rgba(0,0,0,0.25); background: white; transition: 0.3s; display: none; }
        #originalImg { max-width: 100%; max-height: 85vh; display: none; }
        #cropOverlay { 
            position: absolute; border: 2px solid var(--primary); 
            box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6); pointer-events: none; 
        }

        /* UI Elements */
        .section { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid #eee; }
        h3 { margin: 0 0 10px 0; font-size: 0.85rem; color: #888; text-transform: uppercase; letter-spacing: 1px; }
        
        .slider-wrap { margin-bottom: 8px; }
        .slider-wrap label { display: flex; justify-content: space-between; font-size: 0.75rem; font-weight: bold; color: #444; }
        input[type="range"] { width: 100%; margin: 4px 0; cursor: pointer; }
        
        .input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 5px; }
        .input-group label { font-size: 0.7rem; display: block; margin-bottom: 3px; color: #666; }
        .input-group input, .input-group textarea { 
            width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; 
            box-sizing: border-box; font-size: 0.9rem; font-family: inherit;
        }
        
        .btn-group { display: flex; gap: 8px; margin-top: 15px; }
        .btn { flex: 1; padding: 12px; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; transition: 0.2s; font-size: 0.9rem; }
        .btn-primary { background: var(--primary); color: white; }
        .btn-secondary { background: #6c757d; color: white; }
        .btn:disabled { opacity: 0.5; cursor: not-allowed; }
        
        #aspectBadge { 
            display: inline-block; padding: 4px 10px; background: var(--dark); 
            color: #fff; border-radius: 4px; font-family: monospace; font-size: 1rem; margin-top: 8px;
        }

        .preview-results { margin-top: 20px; padding: 15px; background: #f8f9fa; border: 1px solid #ddd; border-radius: 8px; }
        .preview-box { margin-bottom: 12px; }
        .preview-box small { color: #666; font-weight: bold; display: block; margin-bottom: 4px; }
        canvas { max-width: 100%; height: auto; border: 1px solid #bbb; display: block; background: #fff; }

        .target-info { font-size: 0.7rem; color: #007bff; background: #e7f1ff; padding: 5px; border-radius: 4px; margin-top: 5px; }

        /* MODAL PRE PARAMETRE */
        #configModal {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.85); z-index: 1000;
            display: none; align-items: center; justify-content: center;
        }
        .modal-card {
            background: white; padding: 30px; border-radius: 12px; width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,0.5);
        }
        .modal-card h2 { margin-top: 0; font-size: 1.2rem; margin-bottom: 20px; }
        .modal-card label { display: block; font-size: 0.8rem; margin-bottom: 5px; font-weight: bold; margin-top: 10px; }
        .modal-card input, .modal-card select { width: 100%; padding: 12px; margin-bottom: 15px; border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box; font-size: 0.9rem; }
        .modal-card p { font-size: 0.75rem; color: #666; margin-top: -5px; margin-bottom: 20px; }

        /* ŠTÝLY PRE GALÉRIU THUMBNAILOV */
        .gallery-container { width: 100%; max-height: 90vh; overflow-y: auto; padding: 10px; box-sizing: border-box; }
        .gallery-container h2 { font-size: 1.1rem; color: var(--dark); margin-bottom: 15px; border-bottom: 2px solid #ddd; padding-bottom: 8px; }
        .gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 15px; }
        .gallery-item { background: white; border: 1px solid #ccc; padding: 8px; border-radius: 8px; text-align: center; cursor: pointer; transition: 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
        .gallery-item:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.12); }
        .gallery-item img { max-width: 100%; height: 95px; object-fit: cover; border-radius: 4px; display: block; margin: 0 auto 6px auto; background: #f8f9fa; }
        .gallery-item .img-name { font-size: 0.75rem; color: #555; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }