 :root {
            --primary: #4361ee;
            --primary-dark: #3a56d4;
            --primary-light: #4895ef;
            --secondary: #7209b7;
            --accent: #f72585;
            --success: #4cc9f0;
            --warning: #f8961e;
            --danger: #f94144;
            --light: #ffffff;
            --gray: #f8f9fa;
            --gray-dark: #e9ecef;
            --dark: #212529;
            --dark-light: #343a40;
            --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
            --radius: 12px;
            --radius-lg: 20px;
            --transition: all 0.3s ease;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
        }

        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: var(--dark);
            min-height: 100vh;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: flex-start;
        }

        .container {
            max-width: 1400px;
            width: 100%;
            background: var(--light);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            overflow: hidden;
            animation: fadeIn 0.5s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* Header */
        .tool-header {
            background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
            color: var(--light);
            padding: 30px 40px;
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        .tool-header::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" opacity="0.1"><path d="M0,70 C200,10 400,90 600,30 C800,-30 1000,70 1000,70 L1000,100 L0,100 Z"/></svg>');
            background-size: cover;
        }

        .header-content {
            position: relative;
            z-index: 2;
        }

        h1 {
            font-size: 2.5rem;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 15px;
            flex-wrap: wrap;
        }

        .ai-badge {
            background: linear-gradient(135deg, var(--accent), #ff7e5f);
            color: white;
            padding: 8px 20px;
            border-radius: 25px;
            font-size: 1rem;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            gap: 10px;
        }

        .subtitle {
            font-size: 1.1rem;
            opacity: 0.9;
            max-width: 800px;
            margin: 0 auto;
            line-height: 1.6;
        }

        /* Main Content */
        .main-content {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
            padding: 30px;
            min-height: 500px;
        }

        @media (max-width: 1024px) {
            .main-content {
                grid-template-columns: 1fr;
                gap: 25px;
            }
        }

        /* Input/Output Sections */
        .input-container, .output-container {
            background: var(--light);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            padding: 25px;
            display: flex;
            flex-direction: column;
            height: 100%;
        }

        .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .section-title {
            font-size: 1.2rem;
            font-weight: 700;
            color: var(--dark);
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .stats {
            display: flex;
            gap: 12px;
            font-size: 0.9rem;
        }

        .stat-item {
            background: var(--primary);
            color: white;
            padding: 5px 12px;
            border-radius: 15px;
            font-weight: 600;
        }

        .code-area {
            flex: 1;
            min-height: 350px;
            padding: 20px;
            border: 2px solid var(--gray-dark);
            border-radius: var(--radius);
            font-family: 'Courier New', monospace;
            font-size: 14px;
            line-height: 1.5;
            resize: vertical;
            background: var(--gray);
            transition: var(--transition);
            white-space: pre;
            overflow-x: auto;
        }

        .code-area:focus {
            outline: none;
            border-color: var(--primary);
            background: white;
            box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
        }

        .code-area.output {
            background: #f0f9ff;
        }

        /* Controls */
        .controls-section {
            background: var(--light);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            padding: 25px;
            margin-top: 25px;
        }

        .options-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 15px;
            margin-bottom: 25px;
        }

        .option-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px;
            background: var(--gray);
            border-radius: var(--radius);
            transition: var(--transition);
        }

        .option-item:hover {
            background: var(--gray-dark);
        }

        .option-label {
            font-weight: 600;
            color: var(--dark);
            font-size: 0.95rem;
        }

        .toggle-switch {
            position: relative;
            width: 50px;
            height: 26px;
        }

        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: #ccc;
            transition: .4s;
            border-radius: 34px;
        }

        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 18px;
            width: 18px;
            left: 4px;
            bottom: 4px;
            background: white;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked + .toggle-slider {
            background: var(--primary);
        }

        input:checked + .toggle-slider:before {
            transform: translateX(24px);
        }

        .action-buttons {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: 15px;
        }

        .action-btn {
            padding: 14px 20px;
            border: none;
            border-radius: var(--radius);
            font-weight: 600;
            cursor: pointer;
            transition: var(--transition);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            font-size: 0.95rem;
        }

        .action-btn.primary {
            background: var(--primary);
            color: white;
        }

        .action-btn.primary:hover {
            background: var(--primary-dark);
            transform: translateY(-3px);
            box-shadow: var(--shadow);
        }

        .action-btn.secondary {
            background: var(--gray);
            color: var(--dark);
            border: 2px solid var(--gray-dark);
        }

        .action-btn.secondary:hover {
            background: var(--gray-dark);
            transform: translateY(-3px);
        }

        /* Results */
        .results-section {
            margin-top: 25px;
        }

        .results-card {
            background: var(--light);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            padding: 25px;
            margin-bottom: 25px;
        }

        .results-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .savings-display {
            text-align: center;
            margin: 25px 0;
        }

        .savings-circle {
            width: 150px;
            height: 150px;
            border-radius: 50%;
            background: conic-gradient(var(--success) 0% 70%, var(--primary) 70% 100%);
            margin: 0 auto 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        .savings-inner {
            width: 110px;
            height: 110px;
            background: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
        }

        .savings-value {
            font-size: 2rem;
            font-weight: 900;
            color: var(--dark);
        }

        .savings-label {
            font-size: 0.9rem;
            color: var(--dark);
            opacity: 0.7;
        }

        .results-details {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
            gap: 15px;
            margin-bottom: 20px;
        }

        .detail-card {
            background: var(--gray);
            border-radius: var(--radius);
            padding: 18px;
            text-align: center;
            transition: var(--transition);
        }

        .detail-card:hover {
            transform: translateY(-3px);
            box-shadow: var(--shadow);
        }

        .detail-value {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--primary);
            margin-bottom: 5px;
        }

        .detail-label {
            font-size: 0.8rem;
            color: var(--dark);
            opacity: 0.7;
        }

        /* Footer */
        .tool-footer {
            text-align: center;
            padding: 25px;
            background: var(--gray);
            color: var(--dark);
            font-size: 0.9rem;
            border-top: 1px solid var(--gray-dark);
        }

        /* Toast Notification */
        .toast {
            position: fixed;
            bottom: 30px;
            right: 30px;
            background: var(--success);
            color: white;
            padding: 15px 25px;
            border-radius: var(--radius);
            box-shadow: var(--shadow-lg);
            display: none;
            align-items: center;
            gap: 10px;
            z-index: 100;
            animation: slideUp 0.3s ease;
        }

        @keyframes slideUp {
            from { transform: translateY(100px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }

        /* Loading */
        .loader {
            display: none;
            width: 40px;
            height: 40px;
            border: 3px solid var(--gray);
            border-top: 3px solid var(--primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 20px auto;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Responsive */
        @media (max-width: 768px) {
            .container {
                border-radius: 15px;
            }
            
            .tool-header {
                padding: 20px;
            }
            
            h1 {
                font-size: 1.8rem;
                flex-direction: column;
            }
            
            .main-content {
                padding: 20px;
                gap: 20px;
            }
            
            .input-container, .output-container, .controls-section, .results-card {
                padding: 20px;
            }
            
            .options-grid {
                grid-template-columns: 1fr;
            }
            
            .action-buttons {
                grid-template-columns: 1fr;
            }
            
            .savings-circle {
                width: 120px;
                height: 120px;
            }
            
            .savings-inner {
                width: 90px;
                height: 90px;
            }
        }

        @media (max-width: 480px) {
            body {
                padding: 10px;
            }
            
            .main-content {
                padding: 15px;
            }
            
            .code-area {
                min-height: 300px;
            }
        }