/* assets/css/editor.css */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1f2937;
    --light: #f9fafb;
    --lighter: #ffffff;
    --border: #e5e7eb;
    --text: #374151;
    --text-light: #6b7280;
    --text-lighter: #9ca3af;
    --sidebar-width: 280px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f5f7fa;
    color: var(--text);
    overflow-x: hidden;
}

/* ====== LAYOUT PRINCIPAL ====== */
.editor-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--lighter);
    border-right: 1px solid var(--border);
    z-index: 100;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.editor-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* ====== SIDEBAR ====== */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
}

.logo i {
    color: var(--primary);
    font-size: 24px;
}

.logo span {
    color: var(--primary);
}

.sidebar-toggle {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-light);
}

.sidebar-toggle:hover {
    background: var(--primary);
    color: white;
}

.sidebar-nav {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 25px;
}

.nav-section h3 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-section h3 i {
    font-size: 12px;
}

.document-info {
    background: var(--light);
    border-radius: var(--radius);
    padding: 15px;
    border: 1px solid var(--border);
}

#docTitle {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--lighter);
    color: var(--text);
    font-size: 14px;
    margin-bottom: 10px;
}

#docTitle:focus {
    outline: none;
    border-color: var(--primary);
}

.doc-stats {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-light);
}

.doc-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.template-btn {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.template-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.template-btn i {
    font-size: 16px;
}

.template-btn span {
    font-size: 11px;
    text-align: center;
}

.style-presets {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.style-preset {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.style-preset:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 30px 20px;
    text-align: center;
    background: var(--light);
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-area i {
    color: var(--text-light);
    margin-bottom: 10px;
}

.upload-area p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 15px;
}

.btn-upload {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-upload:hover {
    background: var(--primary-dark);
}

.sidebar-actions {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-sidebar-action {
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--light);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-sidebar-action:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-sidebar-action.danger:hover {
    background: var(--danger);
    border-color: var(--danger);
}

/* ====== TOPBAR ====== */
.editor-topbar {
    background: var(--lighter);
    border-bottom: 1px solid var(--border);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-menu {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
}

.btn-menu:hover {
    background: var(--light);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-light);
}

.breadcrumb i {
    font-size: 10px;
}

.topbar-center {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--light);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-light);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 1.5s infinite;
}

.auto-save {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-light);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--light);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

/* ====== TOOLBAR ====== */
.editor-toolbar {
    background: var(--lighter);
    border-bottom: 1px solid var(--border);
    padding: 15px 20px;
    display: flex;
    gap: 20px;
    overflow-x: auto;
}

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

.btn-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--light);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    white-space: nowrap;
}

.btn-toolbar:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-toolbar.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.dropdown-menu {
    display: none;
    position: absolute;
    background: var(--lighter);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 0;
    min-width: 180px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.toolbar-group:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 8px 15px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-menu a:hover {
    background: var(--primary);
    color: white;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.font-select, .size-select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--lighter);
    color: var(--text);
    font-size: 13px;
    min-width: 100px;
    cursor: pointer;
}

.color-picker {
    position: relative;
    display: flex;
    align-items: center;
}

.color-picker input[type="color"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.color-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--light);
    border: 1px solid var(--border);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.color-label:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.divider-vertical {
    width: 1px;
    height: 24px;
    background: var(--border);
}

/* ====== EDITOR CONTAINER ====== */
.editor-container {
    flex: 1;
    background: var(--light);
    margin: 20px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.editor-tabs {
    display: flex;
    background: var(--lighter);
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 12px 20px;
    background: var(--light);
    color: var(--text-light);
    border: none;
    border-right: 1px solid var(--border);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.tab:hover {
    background: var(--lighter);
}

.tab.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    display: none;
    flex: 1;
    overflow: auto;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.editor-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-header {
    padding: 15px 20px;
    background: var(--lighter);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-modes {
    display: flex;
    gap: 5px;
}

.mode-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--light);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 12px;
}

.mode-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.editor-zoom {
    display: flex;
    align-items: center;
    gap: 10px;
}

.zoom-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    background: var(--light);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
}

.zoom-btn:hover {
    background: var(--primary);
    color: white;
}

#zoomLevel {
    font-size: 13px;
    min-width: 40px;
    text-align: center;
}

.editor-area {
    flex: 1;
    padding: 20px;
    background: var(--lighter);
    color: var(--text);
    font-size: 16px;
    line-height: 1.6;
    overflow-y: auto;
    outline: none;
    min-height: 300px;
}

.editor-area:focus {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* ====== PREVIEW TAB ====== */
.preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.preview-toolbar {
    padding: 15px 20px;
    background: var(--lighter);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#previewDevice {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--lighter);
    color: var(--text);
    font-size: 13px;
}

.btn-preview-action {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-content {
    flex: 1;
    padding: 20px;
    overflow: auto;
}

/* ====== HTML TAB ====== */
.html-editor {
    flex: 1;
    width: 100%;
    padding: 20px;
    border: none;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Source Code Pro', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
}

.html-actions {
    padding: 15px 20px;
    background: var(--lighter);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    background: var(--primary-dark);
}

/* ====== STATS TAB ====== */
.stats-container {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--lighter);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.stat-card h4 {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

.stat-numbers {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
}

.stat-chart {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

/* ====== FOOTER ====== */
.editor-footer {
    background: var(--lighter);
    border-top: 1px solid var(--border);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left, .footer-center, .footer-right {
    flex: 1;
}

.editor-info {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: var(--text-light);
}

.editor-info span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-light);
}

.editor-version {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    font-size: 12px;
    color: var(--text-light);
}

.editor-version a {
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ====== MODAIS ====== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--lighter);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--light);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: var(--text);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--lighter);
    color: var(--text);
    font-size: 14px;
}

/* ====== TOASTS ====== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.toast {
    background: var(--lighter);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    min-width: 300px;
    max-width: 400px;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

/* ====== ANIMAÇÕES ====== */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-content {
    animation: fadeIn 0.3s ease;
}