/* 
 * Editor de Texto Web - Estilos principales
 */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Contenedor principal */
.editor-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Barra de herramientas */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    padding: 8px;
    background-color: #f0f0f0;
    border-bottom: 1px solid #ddd;
}

.toolbar-group {
    display: flex;
    margin-right: 15px;
    padding-right: 15px;
    border-right: 1px solid #ddd;
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0 2px;
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
}

.toolbar-button:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
}

.toolbar-button.active {
    background-color: #e0e0e0;
    border-color: #aaa;
}

.toolbar-select {
    height: 36px;
    margin: 0 2px;
    padding: 0 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    color: #555;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 160px;
    padding: 5px 0;
    margin: 2px 0 0;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
}

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

.dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    clear: both;
    font-weight: 400;
    text-align: left;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

/* Área principal del editor */
.editor-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Panel lateral izquierdo */
.folder-sidebar {
    width: 200px;
    padding: 15px;
    background-color: #f8f8f8;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}

.folder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.folder-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.small-button {
    width: 24px;
    height: 24px;
    background-color: transparent;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.small-button:hover {
    background-color: #e0e0e0;
}

.folder-tree {
    margin-bottom: 20px;
}

.folder-item {
    padding: 8px 10px;
    margin-bottom: 5px;
    border-radius: 4px;
    cursor: pointer;
}

.folder-item:hover {
    background-color: #e9e9e9;
}

.folder-item.active {
    background-color: #e0e0e0;
    font-weight: 500;
}

.folder-item i {
    margin-right: 8px;
    color: #888;
}

/* Área de edición central */
.editor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.document-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

#document-title {
    width: 100%;
    padding: 8px;
    font-size: 18px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 4px;
}

#document-title:focus {
    border-color: #aaa;
    outline: none;
}

.editor-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #fff;
    border: none;
    outline: none;
}

/* Panel lateral derecho */
.web-links-sidebar {
    width: 250px;
    padding: 15px;
    background-color: #f8f8f8;
    border-left: 1px solid #ddd;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.web-links-list {
    margin-bottom: 20px;
}

.web-link-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 5px;
    border-radius: 4px;
    background-color: #fff;
    border: 1px solid #eee;
}

.web-link-item a {
    flex: 1;
    color: #0066cc;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.web-link-item a:hover {
    text-decoration: underline;
}

.remove-link-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 12px;
}

.remove-link-btn:hover {
    color: #ff4444;
}

.add-link-form {
    margin-top: 15px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
}

.add-link-form input {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-buttons {
    display: flex;
    justify-content: space-between;
}

.form-buttons button {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f0f0f0;
    cursor: pointer;
}

.form-buttons button:first-child {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* Barra de estado */
.status-bar {
    display: flex;
    padding: 8px 15px;
    background-color: #f0f0f0;
    border-top: 1px solid #ddd;
    font-size: 12px;
    color: #666;
}

.status-item {
    margin-right: 15px;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background-color: #fff;
    margin: 10% auto;
    padding: 0;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 500px;
    max-width: 90%;
}

.modal-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.close-modal {
    color: #aaa;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: #555;
}

.modal-body {
    padding: 15px;
}

.modal-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    text-align: right;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.modal-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.primary-button {
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.primary-button:hover {
    background-color: #45a049;
}

.cancel-button {
    padding: 8px 16px;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-left: 10px;
    cursor: pointer;
}

.cancel-button:hover {
    background-color: #e0e0e0;
}

/* Estilos para modelos de IA */
.ai-models-container {
    position: absolute;
    top: 50px;
    right: 20px;
    width: 300px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 900;
}

.ai-models-header {
    padding: 10px 15px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #ddd;
    border-radius: 5px 5px 0 0;
}

.ai-models-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.ai-models-list {
    max-height: 400px;
    overflow-y: auto;
}

.ai-model-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
}

.ai-model-item:last-child {
    border-bottom: none;
}

.ai-model-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
    border-radius: 50%;
    margin-right: 15px;
}

.ai-model-icon i {
    font-size: 18px;
    color: #555;
}

.ai-model-info {
    flex: 1;
}

.ai-model-name {
    font-weight: 500;
    margin-bottom: 3px;
}

.ai-model-link {
    font-size: 12px;
    color: #0066cc;
    text-decoration: none;
}

.ai-model-link:hover {
    text-decoration: underline;
}

.ai-model-status {
    margin-left: 10px;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ccc;
}

.ai-model-item[data-model-id="openai"] .status-indicator,
.ai-model-item[data-model-id="gemini"] .status-indicator,
.ai-model-item[data-model-id="groq"] .status-indicator,
.ai-model-item[data-model-id="manus"] .status-indicator {
    background-color: #4CAF50;
}

/* Estilos responsivos */
@media (max-width: 992px) {
    .folder-sidebar, .web-links-sidebar {
        width: 180px;
    }
}

@media (max-width: 768px) {
    .editor-main {
        flex-direction: column;
    }
    
    .folder-sidebar, .web-links-sidebar {
        width: 100%;
        max-height: 200px;
    }
    
    .toolbar-group {
        margin-bottom: 5px;
    }
    
    .ai-models-container {
        width: 90%;
        left: 5%;
        right: 5%;
    }
}

/* Estilos para elementos del editor */
.editor-area h1, .editor-area h2, .editor-area h3, 
.editor-area h4, .editor-area h5, .editor-area h6 {
    margin-bottom: 0.5em;
    margin-top: 1em;
}

.editor-area p {
    margin-bottom: 1em;
}

.editor-area ul, .editor-area ol {
    margin-left: 20px;
    margin-bottom: 1em;
}

.editor-area blockquote {
    border-left: 3px solid #ccc;
    margin-left: 0;
    padding-left: 15px;
    color: #666;
}

.editor-area a {
    color: #0066cc;
    text-decoration: none;
}

.editor-area a:hover {
    text-decoration: underline;
}

.editor-area img {
    max-width: 100%;
    height: auto;
}

.editor-area table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1em;
}

.editor-area th, .editor-area td {
    border: 1px solid #ddd;
    padding: 8px;
}

.editor-area th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    margin-bottom: 1em;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
