/* ==========================================================================
   HTML CSS Editor - Modern Design System & Tool Stylesheet
   ========================================================================== */

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'Fira Code', Consolas, Monaco, 'Courier New', monospace;

    /* Light Theme Palette */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-editor: #f8fafc;
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
    --accent-green: #10b981;
    --accent-purple: #8b5cf6;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition-fast: 0.15s ease;
}

[data-theme="dark"] {
    /* Dark Theme Palette (Default for Developers) */
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-card: #131b2e;
    --bg-editor: #0d1322;
    --border-color: #1f2a40;
    --border-focus: #60a5fa;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-blue: #3b82f6;
    --accent-blue-hover: #60a5fa;
    --accent-green: #10b981;
    --accent-purple: #a855f7;
    --accent-orange: #f59e0b;
    --accent-red: #f87171;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.6);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.7);
}

/* Base Resets */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

button, input, select, textarea {
    font-family: inherit;
    font-size: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.3;
}

/* Header & Navigation */
.site-header {
    height: var(--header-height);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.header-container {
    max-width: 1700px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 20px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.badge-pro {
    font-size: 0.65rem;
    padding: 2px 6px;
    background: linear-gradient(135deg, var(--accent-orange), #ea580c);
    color: #fff;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* Header Search Tool Switcher */
.header-search {
    position: relative;
    flex: 1;
    max-width: 480px;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 14px;
    gap: 10px;
    transition: all var(--transition-fast);
}

.search-input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.search-icon {
    color: var(--text-muted);
}

.search-input-wrapper input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 0.88rem;
}

.search-shortcut {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    padding: 2px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    max-height: 380px;
    overflow-y: auto;
    z-index: 150;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.search-result-item:hover {
    background: var(--bg-tertiary);
}

.search-result-item .item-icon {
    color: var(--accent-blue);
}

.search-result-item .item-title {
    font-size: 0.9rem;
    font-weight: 600;
}

.search-result-item .item-cat {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* Nav Links & Dropdowns */
.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-item {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-dropdown-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    min-width: 220px;
    padding: 6px;
    display: none;
    flex-direction: column;
    z-index: 120;
}

.nav-dropdown:hover .dropdown-menu {
    display: flex;
}

.dropdown-menu a {
    padding: 8px 12px;
    font-size: 0.88rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.dropdown-menu a:hover {
    background-color: var(--bg-tertiary);
    color: var(--accent-blue);
}

/* Theme Toggle Button */
.icon-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-focus);
}

/* Main Container Styles */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Editor Specific Layout */
.editor-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

.editor-toolbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--accent-blue);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--accent-blue-hover);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

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

.btn-success {
    background-color: var(--accent-green);
    color: #fff;
}

.btn-danger {
    background-color: var(--accent-red);
    color: #fff;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.78rem;
}

/* Editor Panes Grid */
.editor-split-container {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100% - 49px);
    overflow: hidden;
}

.editor-code-column {
    display: grid;
    grid-template-rows: 1fr 1fr 1fr;
    border-right: 1px solid var(--border-color);
    height: 100%;
    overflow: hidden;
}

.code-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-editor);
}

.code-pane:last-child {
    border-bottom: none;
}

.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.pane-title {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.badge-tag {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
}

.badge-html { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-css { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-js { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.pane-body {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.code-textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    tab-size: 2;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

/* Preview Column */
.editor-preview-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-primary);
}

.preview-frame-wrapper {
    flex: 1;
    position: relative;
    background: #ffffff; /* Preview is standard browser white for web rendering */
}

#previewIframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Interactive Console Tab */
.console-drawer {
    height: 160px;
    background: var(--bg-editor);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.console-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--bg-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.console-output {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-entry {
    display: flex;
    gap: 8px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 2px;
}

.log-info { color: var(--text-secondary); }
.log-warn { color: var(--accent-orange); }
.log-error { color: var(--accent-red); }

/* Standalone Tool Page Layout */
.tool-page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px 60px;
    width: 100%;
}

.tool-header-hero {
    margin-bottom: 24px;
    text-align: left;
}

.tool-header-hero h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-header-hero p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 900px;
}

.tool-workspace-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 40px;
}

.tool-control-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.tool-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
}

.tool-grid-1col {
    padding: 20px;
}

.tool-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.panel-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tool-textarea {
    width: 100%;
    min-height: 380px;
    background: var(--bg-editor);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
    resize: vertical;
    line-height: 1.5;
}

.tool-textarea:focus {
    border-color: var(--border-focus);
}

/* Range Sliders, Inputs, Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.form-input, .form-select {
    background: var(--bg-editor);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    outline: none;
}

.form-input:focus, .form-select:focus {
    border-color: var(--border-focus);
}

.form-range {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Visual Playground Previews (Shadows, Gradients, Flexbox) */
.visual-preview-box {
    min-height: 300px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    position: relative;
    overflow: hidden;
}

.shadow-target-element {
    width: 180px;
    height: 180px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-primary);
    transition: box-shadow 0.1s ease;
}

.gradient-target-element {
    width: 100%;
    height: 240px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* Flexbox Playground Interactive Box */
.flexbox-target-container {
    width: 100%;
    min-height: 280px;
    background: var(--bg-editor);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    gap: 12px;
}

.flex-child-item {
    background: var(--accent-blue);
    color: #fff;
    padding: 20px 24px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SEO Educational Articles & FAQs Section */
.seo-content-section {
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    padding-top: 40px;
}

.seo-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.seo-article h2 {
    font-size: 1.5rem;
    margin: 24px 0 12px;
}

.seo-article h3 {
    font-size: 1.2rem;
    margin: 20px 0 8px;
}

.seo-article p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.seo-article ul, .seo-article ol {
    margin: 12px 0 20px 24px;
    color: var(--text-secondary);
}

.seo-article li {
    margin-bottom: 8px;
}

.faq-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}

.faq-question {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.faq-answer {
    font-size: 0.92rem;
    color: var(--text-secondary);
}

/* Footer Styles */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    padding: 60px 20px 30px;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 12px;
    max-width: 320px;
}

.privacy-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    font-size: 0.8rem;
    color: var(--accent-green);
    font-weight: 500;
}

.footer-heading {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-links a {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--accent-blue);
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-bottom-badges {
    display: flex;
    align-items: center;
    gap: 14px;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    margin-right: 4px;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.toast-notification.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.hidden {
    display: none !important;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .editor-split-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }
    .tool-grid-2col {
        grid-template-columns: 1fr;
    }
    .seo-grid {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 12px;
    }
    .header-search {
        display: none;
    }
    .nav-links {
        display: none;
    }
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}
/* Chỉnh kích thước trong file CSS */
.my-svg-icon {
  width: 50px; /* Nhập kích thước bạn muốn */
  height: auto; /* Giữ nguyên tỷ lệ khung hình */
}