:root {
    --surface: #ffffff;
    --surface-muted: #f4f6fb;
    --border: #e3e8f2;
    --text-main: #1c2333;
    --text-muted: #5f6b85;
    --primary: #0d47fb;
    --primary-dark: #0a2fa3;
    --accent: #8b5cf6;
    --shadow-soft: 0 20px 45px rgba(15, 23, 42, 0.08);
    --shadow-medium: 0 10px 25px rgba(15, 23, 42, 0.1);
    --gradient: linear-gradient(135deg, #0d47fb 0%, #8b5cf6 100%);
    --radius: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tool Hero Section */
.tool-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.hero-text {
    flex: 1;
    min-width: 260px;
}

.hero-text h1 {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0;
    color: var(--text-main);
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 640px;
    margin-bottom: 1rem;
    margin-top: 0.5rem;
    line-height: 1.6;
}

/* Tool Wrapper */
.tool-wrapper {
    margin-bottom: 40px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 32px;
    transition: var(--transition);
}

.tool-card {
    margin-bottom: 0;
}

/* Tool Layout */
.tool-layout {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 32px;
    align-items: start;
}

/* Section Headers */
.section-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 8px 0;
}

.section-description {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Form Elements */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-select-modern,
.form-input-modern {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-main);
    font-size: 14px;
    transition: var(--transition);
    
}

.form-select-modern:focus,
.form-input-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 71, 251, 0.1);
}

.form-select-modern:hover {
    border-color: var(--primary);
}

/* Code Editor */
.code-editor {
    width: 100%;
    min-height: 400px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
    color: var(--text-main);
    
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: var(--transition);
}

.code-editor:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 71, 251, 0.1);
    background: var(--surface);
}

.code-editor::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Options Panel */
.options-panel {
    margin-top: 32px;
    border-top: 1px solid var(--border);
    padding-top: 24px;
}

.options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 12px 0;
    user-select: none;
    transition: var(--transition);
}

.options-header:hover {
    opacity: 0.8;
}

.options-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.options-icon {
    color: var(--text-muted);
    transition: var(--transition);
    font-size: 14px;
}

.options-header.active .options-icon {
    transform: rotate(180deg);
}

.options-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding-top: 24px;
}

.options-content.collapsed {
    max-height: 0;
    padding-top: 0;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.checkbox-label {
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
    user-select: none;
    margin: 0;
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(13, 71, 251, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 71, 251, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--surface-muted);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    border-color: var(--text-muted);
}

.output-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    
}

.btn-icon:hover {
    background: var(--surface-muted);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-icon i {
    font-size: 14px;
}

/* Preview Section */
.preview-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.code-preview {
    min-height: 200px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.preview-placeholder {
    color: var(--text-muted);
    text-align: center;
    margin: 0;
    font-style: italic;
}

/* Generated Code Block Styles */
.code-block {
    border-radius: var(--radius);
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: block;
    overflow-x: auto;
    overflow-y: visible;
}

.code-block table {
    width: 100%;
    border-collapse: collapse;
    
    min-width: 100%;
}

.code-block tr {
    transition: background-color 0.2s ease;
}

.code-block td {
    padding: 4px 12px;
    vertical-align: top;
}

.code-block td:first-child {
    text-align: right;
    user-select: none;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    padding-right: 16px;
    white-space: nowrap;
    /* Width is set dynamically via inline styles based on number of lines */
}

.code-block td:last-child {
    padding-left: 16px;
    white-space: pre;
    overflow: visible;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .tool-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .panel {
        padding: 20px;
        border-radius: 16px;
    }

    .hero-text h1 {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
    }

    .hero-subtitle {
        font-size: clamp(1rem, 3vw, 1.125rem);
    }

    .section-title {
        font-size: 18px;
    }

    .tool-layout {
        gap: 20px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .output-actions {
        width: 100%;
    }

    .btn-icon {
        flex: 1;
        justify-content: center;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .code-editor {
        min-height: 300px;
        font-size: 13px;
    }

    .form-select-modern,
    .form-input-modern {
        padding: 10px 14px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .panel {
        padding: 16px;
    }

    .code-editor {
        min-height: 250px;
        padding: 12px;
    }

    .code-preview {
        padding: 16px;
    }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    :root {
        --surface: #1a1f2e;
        --surface-muted: #252b3d;
        --border: #2d3447;
        --text-main: #e2e8f0;
        --text-muted: #94a3b8;
    }
}

