 :root {
            --primary-color: #4361ee;
            --primary-dark: #3a56d4;
            --secondary-color: #7209b7;
            --success-color: #4cc9f0;
            --light-bg: #f8f9fa;
            --dark-text: #212529;
            --border-color: #dee2e6;
        }

        body {
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
            font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
            padding: 20px 0;
        }

        .container {
            margin-top: 70px;
        }

        .card {
            border: none;
            border-radius: 16px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
            overflow: hidden;
            transition: transform 0.3s ease;
        }

        .card:hover {
            transform: translateY(-5px);
        }

        .card-header {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            border: none;
            padding: 1.5rem;
        }

        .card-title {
            font-weight: 700;
            margin: 0;
            font-size: 1.5rem;
        }

        .upload-area {
            border: 3px dashed var(--primary-color);
            border-radius: 12px;
            padding: 2.5rem 1rem;
            text-align: center;
            background-color: var(--light-bg);
            cursor: pointer;
            transition: all 0.3s ease;
            margin-bottom: 1.5rem;
            position: relative;
            min-height: 180px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        .upload-area:hover {
            background-color: rgba(67, 97, 238, 0.05);
            border-color: var(--primary-dark);
        }

        .upload-icon {
            font-size: 3.5rem;
            color: var(--primary-color);
            margin-bottom: 1rem;
        }

        .upload-text {
            font-size: 1.1rem;
            color: var(--dark-text);
            margin-bottom: 0.5rem;
            font-weight: 600;
        }

        .upload-subtext {
            color: #6c757d;
            font-size: 0.9rem;
        }

        .preview-container {
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 1.5rem;
            background: white;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        .preview-frame {
            width: 100%;
            max-width: 350px;
            aspect-ratio: 3.5/4.5;
            background-color: white;
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            position: relative;
            border: 2px solid var(--primary-color);
            margin: 0 auto;
        }

        #previewCanvas {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            cursor: move;
        }

        .placeholder-text {
            color: #adb5bd;
            font-size: 0.9rem;
            text-align: center;
            padding: 15px;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 100%;
        }

        .face-guide {
            position: absolute;
            top: 40%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 60%;
            height: 55%;
            border: 2px dashed rgba(67, 97, 238, 0.4);
            border-radius: 50%;
            pointer-events: none;
            z-index: 10;
            display: none;
        }

        .drag-instruction {
            position: absolute;
            bottom: 10px;
            left: 0;
            width: 100%;
            text-align: center;
            color: var(--primary-color);
            font-size: 0.75rem;
            background-color: rgba(255, 255, 255, 0.9);
            padding: 6px;
            font-weight: 600;
            display: none;
            z-index: 20;
        }

        .control-card {
            background: var(--light-bg);
            border-radius = 12px;
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            border: 1px solid var(--border-color);
        }

        .control-title {
            color: var(--dark-text);
            font-weight: 600;
            margin-bottom: 1.2rem;
            font-size: 1.1rem;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .form-label {
            font-weight: 600;
            color: var(--dark-text);
            margin-bottom: 0.5rem;
        }

        .form-control,
        .form-select {
            border: 2px solid var(--border-color);
            border-radius: 10px;
            padding: 0.75rem 1rem;
            font-size: 1rem;
            transition: all 0.3s;
        }

        .form-control:focus,
        .form-select:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.15);
        }

        .slider-container {
            margin-bottom: 1.2rem;
        }

        .slider-label {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.5rem;
            font-weight: 600;
            color: var(--dark-text);
        }

        .slider-value {
            background: var(--primary-color);
            color: white;
            padding: 2px 10px;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: 600;
            min-width: 60px;
            text-align: center;
        }

        .slider {
            width: 100%;
            height: 8px;
            -webkit-appearance: none;
            background: #e0e0e0;
            border-radius: 4px;
            outline: none;
        }

        .slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 22px;
            height: 22px;
            background: var(--primary-color);
            border-radius: 50%;
            cursor: pointer;
            border: 3px solid white;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
            border: none;
            border-radius: 10px;
            padding: 0.875rem 1.5rem;
            font-weight: 600;
            font-size: 1rem;
            transition: all 0.3s;
        }

        .btn-primary:hover {
            background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
        }

        .btn-success {
            background: linear-gradient(135deg, #2ecc71, #27ae60);
            border: none;
            border-radius: 10px;
            padding: 0.875rem 1.5rem;
            font-weight: 600;
            font-size: 1rem;
            transition: all 0.3s;
        }

        .btn-success:hover {
            background: linear-gradient(135deg, #27ae60, #2ecc71);
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
        }

        .btn-danger {
            background: linear-gradient(135deg, #e74c3c, #c0392b);
            border: none;
            border-radius: 10px;
            padding: 0.75rem 1.5rem;
            font-weight: 600;
            transition: all 0.3s;
        }

        .btn-danger:hover {
            background: linear-gradient(135deg, #c0392b, #e74c3c);
            transform: translateY(-2px);
        }

        .size-info {
            background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), rgba(114, 9, 183, 0.1));
            border-radius: 12px;
            padding: 1.25rem;
            margin-top: 1.5rem;
            border-left: 4px solid var(--primary-color);
        }

        .size-info h6 {
            color: var(--primary-color);
            font-weight: 700;
            margin-bottom: 0.75rem;
        }

        .size-info p {
            margin-bottom: 0.5rem;
            color: var(--dark-text);
            font-size: 0.9rem;
        }

        .info-badge {
            background: var(--primary-color);
            color: white;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: 600;
        }

        .sample-text {
            font-size: 0.85rem;
            color: #6c757d;
            margin-top: 0.25rem;
        }

        .size-indicator {
            text-align: center;
            margin-top: 10px;
            font-size: 0.85rem;
            color: #666;
            font-weight: 600;
        }

        .size-indicator .actual-size {
            background: var(--primary-color);
            color: white;
            padding: 4px 12px;
            border-radius: 20px;
            display: inline-block;
            margin-top: 5px;
        }

        .icon {
            margin-right: 8px;
        }

        /* Enhanced Text Box with Resize Handles - FULL WIDTH */
        .editable-text-box {
            position: absolute;
            display: none;
            width: 100%;
            min-height: 60px;
            background: rgba(255, 255, 255, 0.9);
            border: 2px solid #4361ee;
            border-radius: 8px;
            padding: 10px 15px;
            z-index: 1000;
            cursor: move;
            overflow: hidden;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            font-family: Arial, sans-serif;
            font-size: 18px;
            font-weight: 700;
            color: #000000;
            text-align: center;
            line-height: 1.4;
            outline: none;
            resize: none;
            user-select: none;
            left: 0;
            box-sizing: border-box;
            white-space: pre-wrap;
            word-wrap: break-word;
            touch-action: manipulation;
        }

        .editable-text-box.active {
            border: 2px solid #3a56d4;
            box-shadow: 0 6px 20px rgba(67, 97, 238, 0.25);
        }

        .editable-text-box.editing {
            cursor: text !important;
            user-select: text !important;
            overflow-y: auto;
        }

        .editable-text-box.editing * {
            user-select: text !important;
        }

        .editable-text-box:not(.editing) {
            user-select: none !important;
        }

        .editable-text-box:not(.editing) * {
            user-select: none !important;
        }

        /* Resize Handles - Larger for mobile */
        .resize-handle {
            position: absolute;
            width: 24px;
            height: 24px;
            background: #4361ee;
            border: 2px solid white;
            border-radius: 50%;
            z-index: 1001;
            touch-action: none;
        }

        /* Only show top and bottom handles for height resizing */
        .resize-handle.top {
            top: -12px;
            left: 50%;
            transform: translateX(-50%);
            cursor: ns-resize;
        }

        .resize-handle.bottom {
            bottom: -12px;
            left: 50%;
            transform = translateX(-50%);
            cursor: ns-resize;
        }

        /* Move Cursor */
        .move-cursor {
            position: absolute;
            top: 5px;
            right: 5px;
            width: 30px;
            height: 30px;
            cursor: move;
            color: #4361ee;
            z-index: 1001;
            background: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
            touch-action: none;
        }

        /* Filter Controls */
        .filter-option {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px;
            margin-bottom: 8px;
            background: white;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .filter-option:hover {
            background: var(--light-bg);
            border-color: var(--primary-color);
        }

        .filter-option.active {
            background: rgba(67, 97, 238, 0.1);
            border-color: var(--primary-color);
        }

        .filter-slider {
            width: 100%;
            margin-top: 8px;
        }

        .filter-value {
            font-size: 0.85rem;
            color: var(--primary-color);
            font-weight: 600;
        }

        /* Footer */
        .footer {
            background: linear-gradient(135deg, #2b2d42, #1d1e2c);
            color: white;
            padding: 2rem 1rem;
            margin-top: 3rem;
            text-align: center;
        }

        .social-icons {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin: 1rem 0;
        }

        .social-icons a {
            color: white;
            font-size: 1.5rem;
            transition: color 0.3s;
        }

        .social-icons a:hover {
            color: var(--primary-color);
        }

        .footer-links a {
            color: #adb5bd;
            text-decoration: none;
            margin: 0 10px;
            transition: color 0.3s;
        }

        .footer-links a:hover {
            color: white;
        }

        /* Toast Styles */
        .toast {
            z-index: 9999;
        }

        /* Logo Container */
        .logo-container {
            position: absolute;
            top: 10px;
            right: 20px;
            display: flex;
            gap: 10px;
            z-index: 999;
        }

        .made-in-india,
        .digital-india,
        .secure-india {
            height: 70px;
            width: auto;
        }

       /* Upload Area Enhancements - UPDATED */
        #imageInput {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            opacity: 0;
            cursor: pointer;
            z-index: 10;
        }

        .upload-content {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 100%;
            width: 100%;
        }

        /* Mobile Responsive */
        @media (max-width: 768px) {
            body {
                padding: 10px 0;
            }
            
            .container {
                margin-top: 70px;
            }
            
            .card-header {
                padding: 1rem;
            }
            
            .card-title {
                font-size: 1.3rem;
            }
            
            .card-body {
                padding: 1.25rem !important;
            }
            
            .upload-area {
                padding: 1.5rem 0.75rem;
                margin-bottom: 1rem;
                min-height: 150px;
            }
            
            .upload-icon {
                font-size: 2.5rem;
            }
            
            .upload-text {
                font-size: 1rem;
            }
            
            .control-card {
                padding: 1rem;
                margin-bottom: 1rem;
            }
            
            .preview-container {
                margin-top: 1rem;
                padding: 15px;
            }
            
            .preview-frame {
                max-width: 280px;
                min-height: 360px;
            }
            
            .editable-text-box {
                width: 100%;
                min-height: 60px;
                padding: 12px 15px;
                font-size: 16px;
            }
            
            .btn {
                padding: 0.75rem 1rem;
                font-size: 0.95rem;
            }
            
            .btn-success {
                padding: 1rem !important;
                font-size: 1.1rem;
            }
            
            .alert {
                padding: 1rem;
                font-size: 0.9rem;
            }
            
            .size-info {
                padding: 1rem;
                margin-top: 1rem;
            }
            
            .slider-label {
                font-size: 0.9rem;
            }
            
            .slider-value {
                font-size: 0.8rem;
                padding: 2px 8px;
                min-width: 50px;
            }
            
            .form-control,
            .form-select {
                padding: 0.625rem 0.875rem;
                font-size: 0.95rem;
            }
            
            .sample-text {
                font-size: 0.8rem;
            }
            
            .info-badge {
                font-size = 0.75rem;
                padding: 3px 8px;
            }
            
            .footer {
                padding: 1rem;
                font-size: 0.85rem;
            }
            
            .social-icons {
                font-size: 1.2rem;
            }
            
            .footer-links {
                font-size: 0.8rem;
            }
            
            .placeholder-text {
                font-size: 0.85rem;
                padding: 10px;
            }
            
            .drag-instruction {
                bottom: 60px;
                font-size: 0.7rem;
                padding: 5px;
            }
            
            /* Larger touch targets for mobile */
            .resize-handle {
                width: 28px !important;
                height: 28px !important;
            }
            
            .move-cursor {
                width: 36px !important;
                height: 36px !important;
                font-size: 16px !important;
            }
            
            .made-in-india,
            .digital-india,
            .secure-india {
                height: 40px;
            }

            .logo-container {
                top: 5px;
                right: 10px;
                gap: 5px;
            }
        }

        /* Prevent iOS text selection and improve touch */
        * {
            -webkit-tap-highlight-color: transparent;
        }
        
        /* Better touch for resize handles */
        .resize-handle::after {
            content: '';
            position: absolute;
            top: -15px;
            left: -15px;
            right: -15px;
            bottom: -15px;
            z-index: 1001;
        }