: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 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: 1fr 1fr;
    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;
}

/* 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;
}

.code-editor[readonly] {
    background: var(--surface-muted);
    cursor: text;
}

/* 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;
}

/* 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;
}

.btn-icon.copied {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

/* 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;
}

.code-preview * {
    max-width: 100%;
    word-wrap: break-word;
}

.code-preview a {
    color: var(--primary);
    text-decoration: underline;
}

.code-preview a:hover {
    color: var(--primary-dark);
}

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

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

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

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

    .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;
    }

    .code-preview {
        padding: 16px;
        min-height: 150px;
    }
}

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

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

    .code-preview {
        padding: 12px;
        min-height: 120px;
    }

    .checkbox-grid {
        gap: 12px;
    }
}

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

