/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #1e7e34;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Login Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    color: #333;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #007bff;
}

.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 0.5rem;
    text-align: center;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e1e5e9;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left h1 {
    font-size: 1.5rem;
    color: #333;
}

.last-saved {
    font-size: 0.875rem;
    color: #6c757d;
    font-style: italic;
}

.header-right {
    display: flex;
    gap: 0.5rem;
}

/* Main Content */
.main-content {
    display: flex;
    height: calc(100vh - 120px);
    background: #f8f9fa;
}

.panel {
    flex: 1;
    background: white;
    margin: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 1.1rem;
    color: #333;
}

.editor-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Editor Container */
.editor-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Preview Container */
.preview-container {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    line-height: 1.6;
}

.preview-container h1,
.preview-container h2,
.preview-container h3,
.preview-container h4,
.preview-container h5,
.preview-container h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.preview-container h1 {
    font-size: 2rem;
    border-bottom: 2px solid #e1e5e9;
    padding-bottom: 0.5rem;
}

.preview-container h2 {
    font-size: 1.5rem;
}

.preview-container h3 {
    font-size: 1.25rem;
}

.preview-container p {
    margin-bottom: 1rem;
}

.preview-container code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
}

.preview-container pre {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.preview-container pre code {
    background: none;
    padding: 0;
}

.preview-container blockquote {
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #6c757d;
    font-style: italic;
}

.preview-container ul,
.preview-container ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.preview-container li {
    margin-bottom: 0.25rem;
}

.preview-container table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.preview-container th,
.preview-container td {
    border: 1px solid #e1e5e9;
    padding: 0.5rem;
    text-align: left;
}

.preview-container th {
    background: #f8f9fa;
    font-weight: 600;
}

/* Status Bar */
.status-bar {
    background: white;
    border-top: 1px solid #e1e5e9;
    padding: 0.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #6c757d;
}

.status-connected {
    color: #28a745;
}

.status-disconnected {
    color: #dc3545;
}

/* Loading Spinner */
.spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.spinner-circle {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e5e9;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner p {
    margin-top: 1rem;
    color: #6c757d;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .header-right {
        flex-wrap: wrap;
        justify-content: center;
    }

    .main-content {
        flex-direction: column;
        height: calc(100vh - 160px);
    }

    .panel {
        margin: 0.5rem;
    }

    .editor-stats {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Monaco Editor Overrides */
.monaco-editor {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    font-size: 14px !important;
}

.monaco-editor .margin {
    background-color: #f8f9fa !important;
}

.monaco-editor .current-line {
    background-color: rgba(0, 123, 255, 0.1) !important;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
