/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background: #c0c0c0;
    height: 100vh;
    overflow: hidden;
}

/* Window container */
.window {
    width: 100vw;
    height: 100vh;
    background: #c0c0c0;
    display: flex;
    flex-direction: column;
    border: 2px outset #c0c0c0;
}

/* Title bar */
.title-bar {
    background: linear-gradient(90deg, #0a246a 0%, #a6caf0 100%);
    color: white;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    font-size: 11px;
    font-weight: bold;
    border-bottom: 1px solid #c0c0c0;
}

.title-bar-text {
    flex: 1;
}

.title-bar-controls {
    display: flex;
    gap: 2px;
}

.title-bar-controls button {
    width: 16px;
    height: 14px;
    background: #c0c0c0;
    border: 1px outset #c0c0c0;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.title-bar-controls button:hover {
    background: #d4d0c8;
}

.title-bar-controls button:active {
    border: 1px inset #c0c0c0;
}

/* Menu bar */
.menu-bar {
    background: #c0c0c0;
    height: 22px;
    display: flex;
    align-items: center;
    padding: 0 4px;
    border-bottom: 1px solid #c0c0c0;
    font-size: 11px;
}

.menu-item {
    padding: 2px 8px;
    cursor: pointer;
    border: 1px solid transparent;
}

.menu-item:hover {
    background: #d4d0c8;
    border: 1px outset #c0c0c0;
}

.menu-item:active {
    border: 1px inset #c0c0c0;
}

/* Editor container */
.editor-container {
    flex: 1;
    display: flex;
    background: white;
    overflow: hidden;
}

/* Line numbers */
.line-numbers {
    background: #f0f0f0;
    width: 50px;
    border-right: 1px solid #c0c0c0;
    padding: 4px 0;
    font-size: 11px;
    color: #666;
    text-align: right;
    user-select: none;
    overflow: hidden;
    position: relative;
    height: 100%;
    pointer-events: none;
}

/* Line numbers content container */
.line-numbers-content {
    position: relative;
    height: 16000px; /* 1000 lines * 16px per line */
}

.line-number {
    height: 16px;
    line-height: 16px;
    padding-right: 8px;
}

/* Editor content */
.editor-content {
    flex: 1;
    overflow: auto;
    background: white;
    position: relative;
}

.text-content {
    padding: 4px 8px;
    font-size: 11px;
    line-height: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    color: #000;
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.line {
    min-height: 16px;
    position: relative;
}

.cursor-line {
    position: relative;
    display: flex;
    align-items: flex-start;
}

.cursor {
    animation: blink 1s infinite;
    color: #000;
    font-weight: normal;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Status bar */
.status-bar {
    background: #c0c0c0;
    height: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    font-size: 11px;
    border-top: 1px solid #c0c0c0;
    border-bottom: 1px solid #c0c0c0;
}

.status-left {
    color: #000;
}

.status-right {
    color: #000;
}

/* Typing indicator */
.typing-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.typing-indicator .status-bar {
    background: #ffff99;
    border-top: 1px solid #c0c0c0;
}

/* Scrollbar styling */
.editor-content::-webkit-scrollbar {
    width: 16px;
}

.editor-content::-webkit-scrollbar-track {
    background: #c0c0c0;
    border: 1px inset #c0c0c0;
}

.editor-content::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border: 1px outset #c0c0c0;
}

.editor-content::-webkit-scrollbar-thumb:hover {
    background: #d4d0c8;
}

.editor-content::-webkit-scrollbar-corner {
    background: #c0c0c0;
}

/* Message styling */
.message {
    margin-bottom: 8px;
}

.message-content {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    line-height: 16px;
    font-size: 11px;
    color: #000;
}

.guardian-message .message-content {
    background: transparent;
    border: none;
    font-style: normal;
    color: #000;
}

.user-message .message-content {
    background: transparent;
    border: none;
    margin-left: 0;
    color: #000;
}

.message-time {
    display: none;
}

/* Input styling */
.input-container {
    display: none;
}

/* Character count */
.character-count {
    display: none;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    padding: 20px;
    text-align: center;
    color: #000;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 11px;
}

/* Responsive design */
@media (max-width: 768px) {
    .window {
        width: 100vw;
        height: 100vh;
    }
    
    .line-numbers {
        width: 40px;
    }
    
    .line-number {
        font-size: 10px;
    }
    
    .text-content {
        font-size: 10px;
    }
}

/* Focus styles */
.editor-content:focus {
    outline: none;
}

/* Selection styles */
::selection {
    background: #316ac5;
    color: white;
}

::-moz-selection {
    background: #316ac5;
    color: white;
}

/* Special effects for the text editor feel */
.window {
    box-shadow: 
        inset -1px -1px 0 #808080,
        inset 1px 1px 0 #ffffff,
        2px 2px 4px rgba(0, 0, 0, 0.3);
}

.editor-container {
    border: 1px inset #c0c0c0;
}

/* Animation for new text appearing */
@keyframes typewriter {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.typing-text {
    animation: typewriter 0.1s ease-in;
}

/* Cursor positioning */
.cursor-line {
    position: relative;
}

.cursor {
    animation: blink 1s infinite;
    color: #000;
    font-weight: normal;
    display: inline;
}

/* Dark mode option (can be toggled) */
.dark-mode {
    background: #000;
    color: #00ff00;
}

.dark-mode .window {
    background: #000;
    border-color: #333;
}

.dark-mode .title-bar {
    background: linear-gradient(90deg, #000080 0%, #0080ff 100%);
}

.dark-mode .menu-bar,
.dark-mode .status-bar {
    background: #333;
    color: #00ff00;
}

.dark-mode .editor-container {
    background: #000;
    border-color: #333;
}

.dark-mode .line-numbers {
    background: #1a1a1a;
    color: #666;
    border-color: #333;
}

.dark-mode .text-content {
    background: #000;
    color: #00ff00;
}

.dark-mode .cursor {
    color: #00ff00;
}