/* Reset và cơ bản */
:root {
    --primary-color: #4b6cb7;
    --secondary-color: #182848;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --text-color: #334155;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --light-color: #1e293b;
    --dark-color: #f8fafc;
    --text-color: #cbd5e1;
    --text-light: #94a3b8;
    --border-color: #334155;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
    transition: var(--transition);
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    background-color: var(--light-color);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 25px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-content h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-content h1 i {
    color: #6dd5ed;
    font-size: 36px;
}

.subtitle {
    font-size: 16px;
    opacity: 0.9;
    font-weight: 400;
    max-width: 600px;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.home-btn {
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px 28px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    font-size: 15px;
}

.home-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.theme-btn {
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 18px;
}

.theme-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: rotate(30deg);
}

/* Main content */
main {
    flex: 1;
    padding: 40px;
}

.converter-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 50px;
    height: 70vh;
    min-height: 600px;
}

@media (max-width: 1400px) {
    .converter-wrapper {
        height: 65vh;
    }
}

@media (max-width: 1024px) {
    .converter-wrapper {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
    }
}

/* Input và Output sections */
.input-section, .output-section {
    background-color: var(--light-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.section-header {
    background-color: rgba(75, 108, 183, 0.05);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    border: 2px solid transparent;
    white-space: nowrap;
}

.action-btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.action-btn.primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(75, 108, 183, 0.3);
}

.action-btn.success {
    background-color: var(--success-color);
    color: white;
}

.action-btn.success:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.action-btn.danger {
    background-color: var(--danger-color);
    color: white;
}

.action-btn.danger:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.action-btn:hover {
    transform: translateY(-2px);
}

/* TinyMCE Editor Container */
.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#tinymce-editor {
    flex: 1;
    overflow: hidden;
}

/* Override TinyMCE styles to match our theme */
.tox-tinymce {
    border: none !important;
    border-radius: 0 !important;
    height: 100% !important;
}

.tox-editor-container {
    height: 100% !important;
}

.tox-sidebar-wrap {
    height: 100% !important;
}

.tox .tox-editor-header {
    border-bottom: 1px solid var(--border-color) !important;
    background-color: rgba(75, 108, 183, 0.05) !important;
}

.editor-footer {
    padding: 18px 30px;
    background-color: rgba(75, 108, 183, 0.05);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.editor-stats {
    display: flex;
    gap: 25px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.editor-options {
    display: flex;
    gap: 12px;
}

.option-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.option-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Code container */
.code-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.code-tabs {
    display: flex;
    background-color: var(--dark-color);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: thin;
}

.code-tabs::-webkit-scrollbar {
    height: 6px;
}

.code-tabs::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 3px;
}

.code-tab {
    background-color: transparent;
    color: var(--text-light);
    border: none;
    padding: 16px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border-right: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.code-tab:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
}

.code-tab.active {
    color: white;
    background-color: rgba(75, 108, 183, 0.2);
    border-bottom: 3px solid var(--primary-color);
}

.code-tab i {
    font-size: 18px;
}

.code-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.code-output {
    display: none;
    height: 100%;
    flex-direction: column;
}

.code-output.active {
    display: flex;
}

.code-header {
    padding: 18px 25px;
    background-color: rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.code-header span {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 16px;
}

.copy-code-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.copy-code-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* Code Output Styling - Sublime Text Theme */
.code-output pre {
    flex: 1;
    margin: 0;
    padding: 0;
    overflow: auto;
    background-color: #1e1e1e !important;
}

.code-output code {
    display: block;
    padding: 25px;
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 15px;
    line-height: 1.6;
    height: 100%;
    overflow: auto;
    tab-size: 2;
    background-color: transparent !important;
    color: #d4d4d4;
}

/* Sublime Text Inspired Syntax Highlighting */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #6a9955;
    font-style: italic;
}

.token.punctuation {
    color: #d4d4d4;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
    color: #b5cea8;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: #ce9178;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: #d4d4d4;
    background: transparent;
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: #569cd6;
}

.token.function,
.token.class-name {
    color: #dcdcaa;
}

.token.regex,
.token.important,
.token.variable {
    color: #d16969;
}

.token.important,
.token.bold {
    font-weight: bold;
}

.token.italic {
    font-style: italic;
}

.token.entity {
    cursor: help;
}

/* HTML Specific */
.language-html .token.tag {
    color: #569cd6;
}

.language-html .token.attr-name {
    color: #9cdcfe;
}

.language-html .token.attr-value {
    color: #ce9178;
}

.language-html .token.punctuation {
    color: #808080;
}

/* CSS Specific */
.language-css .token.selector {
    color: #d7ba7d;
}

.language-css .token.property {
    color: #9cdcfe;
}

.language-css .token.function {
    color: #dcdcaa;
}

/* JavaScript Specific */
.language-javascript .token.keyword {
    color: #569cd6;
}

.language-javascript .token.function {
    color: #dcdcaa;
}

.language-javascript .token.string {
    color: #ce9178;
}

.language-javascript .token.number {
    color: #b5cea8;
}

.language-javascript .token.operator {
    color: #d4d4d4;
}

/* Line numbers */
pre[class*="language-"].line-numbers {
    position: relative;
    padding-left: 3.8em;
    counter-reset: linenumber;
}

pre[class*="language-"].line-numbers > code {
    position: relative;
    white-space: inherit;
}

.line-numbers .line-numbers-rows {
    position: absolute;
    pointer-events: none;
    top: 0;
    font-size: 100%;
    left: -3.8em;
    width: 3em;
    letter-spacing: -1px;
    border-right: 1px solid #999;
    user-select: none;
}

.line-numbers-rows > span {
    pointer-events: none;
    display: block;
    counter-increment: linenumber;
}

.line-numbers-rows > span:before {
    content: counter(linenumber);
    color: #999;
    display: block;
    padding-right: 0.8em;
    text-align: right;
}

/* Preview section */
.preview-actions {
    display: flex;
    gap: 12px;
}

.preview-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.preview-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.preview-container {
    flex: 1;
    padding: 20px;
    background-color: white;
    overflow: hidden;
}

#previewFrame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 10px;
    background-color: white;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

/* All files section */
.all-files {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.file-section {
    margin-bottom: 30px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.file-section h4 {
    padding: 15px 20px;
    background-color: rgba(75, 108, 183, 0.1);
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
}

.file-section pre {
    margin: 0;
    max-height: 300px;
    overflow: auto;
}

/* Info section */
.info-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 50px;
}

@media (max-width: 1024px) {
    .info-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .info-section {
        grid-template-columns: 1fr;
    }
}

.info-card {
    background-color: var(--light-color);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: var(--transition);
    border: 1px solid transparent;
}

.info-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.info-card i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 25px;
    transition: var(--transition);
}

.info-card:hover i {
    transform: scale(1.1);
}

.info-card h3 {
    font-size: 22px;
    margin-bottom: 18px;
    color: var(--dark-color);
    font-weight: 700;
}

.info-card p {
    color: var(--text-light);
    font-size: 16px;
    line-height: 1.7;
}

/* Footer */
footer {
    background-color: rgba(75, 108, 183, 0.05);
    padding: 30px 40px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-content {
    text-align: center;
}

footer p {
    color: var(--text-light);
    font-size: 15px;
    margin-bottom: 12px;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

footer a:hover {
    text-decoration: underline;
    color: var(--secondary-color);
}

.footer-note {
    color: var(--success-color);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.footer-link {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.footer-link:hover {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
}

/* Notification */
.notification {
    position: fixed;
    top: 30px;
    right: 30px;
    padding: 20px 25px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10000;
    animation: slideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), fadeOut 0.4s ease 2.6s forwards;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.notification.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.95) 100%);
}

.notification.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95) 0%, rgba(185, 28, 28, 0.95) 100%);
}

.notification.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95) 0%, rgba(29, 78, 216, 0.95) 100%);
}

.notification i {
    font-size: 22px;
}

@keyframes slideIn {
    from { transform: translateX(100%) translateY(-20px); opacity: 0; }
    to { transform: translateX(0) translateY(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--light-color);
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 1px solid var(--border-color);
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    padding: 25px 30px;
    background-color: rgba(75, 108, 183, 0.1);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 28px;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.modal-close:hover {
    color: var(--danger-color);
    background-color: rgba(239, 68, 68, 0.1);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(90vh - 100px);
}

/* Responsive */
@media (max-width: 1400px) {
    .header-content h1 {
        font-size: 28px;
    }
    
    .converter-wrapper {
        gap: 30px;
    }
    
    .section-header {
        padding: 18px 25px;
    }
    
    .code-tab {
        padding: 14px 22px;
        font-size: 14px;
    }
}

@media (max-width: 1200px) {
    main {
        padding: 30px;
    }
    
    .info-card {
        padding: 25px;
    }
}

@media (max-width: 1024px) {
    header {
        padding: 20px 30px;
    }
    
    .header-content h1 {
        font-size: 26px;
    }
    
    .converter-wrapper {
        gap: 25px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 16px;
    }
    
    header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        padding: 20px;
    }
    
    .header-content h1 {
        justify-content: center;
        font-size: 24px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    main {
        padding: 20px;
    }
    
    .editor-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .editor-stats {
        width: 100%;
        justify-content: space-between;
    }
    
    .code-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .code-tab {
        padding: 12px 18px;
        font-size: 13px;
    }
    
    .info-section {
        gap: 20px;
    }
    
    footer {
        padding: 25px 20px;
    }
    
    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 22px;
    }
    
    .section-header h2 {
        font-size: 18px;
    }
    
    .action-btn {
        padding: 8px 15px;
        font-size: 13px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .info-card {
        padding: 20px;
    }
    
    .info-card h3 {
        font-size: 20px;
    }
}