/* General Styles and Layout */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background: #f0f2f5;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    /* Wider editor panel: 500px fixed width */
    display: grid;
    grid-template-columns: 500px 1fr;
    gap: 20px;
}

@media (max-width: 1000px) {
    .container {
        grid-template-columns: 1fr;
    }
    .editor-panel {
        position: static;
    }
}

.editor-panel {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
    overflow: auto;
    max-height: 95vh;
}

.preview-panel {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-height: 95vh;
    overflow: auto;
}

/* Typography */
h1, h2 {
    color: #333;
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
h1 { font-size: 1.8em; }
h2 { font-size: 1.4em; }

/* Form Elements */
label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

input[type="text"], input[type="date"], input[type="number"], textarea, select {
    width: 100%;
    padding: 10px;
    margin-bottom: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus {
    border-color: #007bff;
    outline: none;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-success, .btn-danger {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s, box-shadow 0.2s;
    margin-right: 5px;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}
.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}
.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-success {
    background-color: #28a745;
    color: white;
}
.btn-success:hover {
    background-color: #1e7e34;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}
.btn-danger:hover {
    background-color: #c82333;
}

.btn-toolbar {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    margin: 2px;
    font-size: 0.9em;
    padding: 5px 10px;
}
.btn-toolbar:hover {
    background: #e9ecef;
}

.btn-group {
    margin-top: 20px;
    display: flex;
    justify-content: flex-start;
}

.url-input-group {
    display: flex;
    gap: 10px;
}
.url-input-group input {
    flex-grow: 1;
    margin-bottom: 0;
}
.url-input-group button {
    flex-shrink: 0;
    margin-right: 0;
}

/* Tab Styles */
.tab-buttons {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}
.tab-button {
    background: none;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    color: #555;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.tab-button.active {
    color: #007bff;
    border-bottom-color: #007bff;
    font-weight: 600;
}
.tab-content {
    padding-top: 10px;
}

/* Rich Text Editor */
.rich-text-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
}
.toolbar {
    border-bottom: 1px solid #ddd;
    padding: 5px;
    display: flex;
}
.rich-text-editor-area {
    min-height: 100px;
    padding: 10px;
    outline: none;
}

/* Entry List */
.entry-list {
    list-style: none;
    padding: 0;
}
.entry-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 8px;
    border: 1px solid #eee;
}
.entry-list-item strong {
    display: block;
    margin-bottom: 3px;
    font-size: 1em;
    color: #333;
}
.entry-list-item small {
    font-size: 0.85em;
    color: #666;
    margin-right: 10px;
}
.entry-actions button {
    margin-left: 5px;
    padding: 5px 10px;
    font-size: 0.9em;
}

/* Status Message */
.status-message {
    padding: 10px;
    margin-top: 10px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
    display: none; /* hidden by default */
}
.status-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.status-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Loading Spinner */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    display: none;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Styles */
.custom-modal-overlay, #authModalOverlay {
    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;
    display: none;
}

.custom-modal {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.custom-modal p {
    font-size: 1.1em;
    margin-bottom: 20px;
}

.custom-modal-buttons {
    display: flex;
    justify-content: space-around;
}
