* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f0f0f0;
    height: 100vh;
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Стили для Windows-подобного интерфейса */
.window {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.title-bar {
    background: linear-gradient(180deg, #f0f0f0 0%, #e5e5e5 100%);
    padding: 8px 12px;
    border-bottom: 1px solid #ccc;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.title-bar-text {
    font-weight: 600;
    color: #333;
    flex-grow: 1;
}

.title-bar-controls {
    display: flex;
    gap: 4px;
}

.title-bar-controls button {
    background: transparent;
    border: 1px solid transparent;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    border-radius: 2px;
}

.title-bar-controls button:hover {
    background-color: rgba(0,0,0,0.05);
    border-color: #999;
}

/* Панель инструментов */
.toolbar {
    background: linear-gradient(180deg, #f8f8f8 0%, #f0f0f0 100%);
    padding: 4px;
    border-bottom: 1px solid #ccc;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    gap: 2px;
    padding: 2px;
    border-right: 1px solid #ccc;
    margin-right: 4px;
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-button {
    background: transparent;
    border: 1px solid transparent;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #333;
}

.toolbar-button i {
    font-size: 16px;
}

.toolbar-button:hover {
    background-color: #e5e5e5;
    border-color: #999;
}

.toolbar-button:active {
    background-color: #ccc;
}

/* Табы */
.tabs-container {
    display: flex;
    background-color: #f0f0f0;
    border-bottom: 1px solid #ccc;
    padding: 4px 4px 0 4px;
    gap: 2px;
}

.tab {
    background: linear-gradient(180deg, #e8e8e8 0%, #d8d8d8 100%);
    border: 1px solid #ccc;
    border-bottom: none;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    font-size: 13px;
    color: #333;
}

.tab.active {
    background: #f9f9f9;
    border-bottom: 1px solid #f9f9f9;
    margin-bottom: -1px;
    font-weight: 600;
}

.tab-close {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    padding: 0 4px;
}

.tab-close:hover {
    color: #000;
}

.tab-new {
    background: transparent;
    border: 1px solid #ccc;
    padding: 4px 12px;
    cursor: pointer;
    border-radius: 4px;
    margin: 4px;
}

/* Редактор */
.editor-container {
    flex-grow: 1;
    background-color: white;
    overflow: hidden;
    position: relative;
}

#monaco-editor {
    width: 100%;
    height: 100%;
    position: absolute;
}

/* Страницы входа/регистрации */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.auth-box h2 {
    margin-bottom: 30px;
    color: #333;
    text-align: center;
}

.auth-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.auth-input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

.auth-button:hover {
    transform: translateY(-2px);
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.error-message {
    color: #e74c3c;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #fde8e8;
    border-radius: 4px;
    text-align: center;
}

.notification-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: #333;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.toolbar-button.active {
    background-color: #d0e0f0;
    border-color: #7aa;
}
.toolbar-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.toolbar-button.small {
    padding: 4px 8px;
    font-size: 12px;
}
.toolbar-button.danger:hover {
    background-color: #fdd;
    border-color: #c66;
    color: #c00;
}
.history-badge {
    background: #667eea;
    color: #fff;
    font-size: 11px;
    padding: 1px 5px;
    border-radius: 10px;
    margin-left: 4px;
}

/* Панель истории закрытых вкладок */
.closed-history-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.35);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.closed-history-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.closed-history-header {
    padding: 12px 16px;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f5f5f5;
}
.closed-history-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}
.closed-history-close {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0 6px;
    line-height: 1;
}
.closed-history-close:hover {
    color: #000;
}
.closed-history-list {
    overflow-y: auto;
    padding: 8px;
}
.closed-history-item {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #fafafa;
}
.closed-history-item:last-child {
    margin-bottom: 0;
}
.closed-history-item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.closed-history-title {
    font-weight: 600;
    color: #333;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.closed-history-lang {
    font-size: 11px;
    color: #666;
    background: #e8e8e8;
    padding: 2px 6px;
    border-radius: 4px;
}
.closed-history-preview {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: #555;
    margin: 0 0 8px 0;
    padding: 6px 8px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 60px;
    overflow: hidden;
}
.closed-history-actions {
    display: flex;
    gap: 6px;
}
.closed-history-empty {
    padding: 24px;
    text-align: center;
    color: #888;
}