/* Wikimini - A distinctive wiki with retro-academic aesthetic */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@400;600;700&family=IBM+Plex+Mono:wght@400;500&family=Libre+Baskerville:wght@700&display=swap');

:root {
    --primary-color: #2c5f2d;
    --secondary-color: #97bc62;
    --accent-color: #d4a373;
    --dark-bg: #1a1a1a;
    --light-bg: #f8f6f1;
    --paper-bg: #fefdfb;
    --text-dark: #2a2a2a;
    --text-muted: #6a6a6a;
    --border-color: #d4cfc4;
    --diff-add: #d4edda;
    --diff-remove: #f8d7da;
    --diff-add-text: #155724;
    --diff-remove-text: #721c24;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);
    --body-bg: linear-gradient(135deg, #f5f3ed 0%, #fefdfb 50%, #f8f6f1 100%);
}

/* Dark mode variables */
[data-theme="dark"] {
    --primary-color: #5a9f5d;
    --secondary-color: #7a9c52;
    --accent-color: #e8b678;
    --dark-bg: #0f0f0f;
    --light-bg: #1a1a1a;
    --paper-bg: #1e1e1e;
    --text-dark: #e5e5e5;
    --text-muted: #a0a0a0;
    --border-color: #3a3a3a;
    --diff-add: #1e3a1e;
    --diff-remove: #3a1e1e;
    --diff-add-text: #90ee90;
    --diff-remove-text: #ff9999;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.5);
    --body-bg: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #151515 100%);
}

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

body {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 18px;
    line-height: 1.7;
    color: var(--text-dark);
    background: var(--body-bg);
    background-attachment: fixed;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Header */
.site-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #234a24 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-lg);
    border-bottom: 3px solid var(--accent-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: white;
}

.logo-icon {
    font-size: 2.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.logo h1 {
    font-family: 'Libre Baskerville', serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.logo small {
    display: block;
    font-size: 0.7rem;
    opacity: 0.9;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-family: 'Crimson Pro', serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 2px 8px rgba(212, 163, 115, 0.3);
}

.btn-primary:hover {
    background: #c49566;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 163, 115, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.main-content {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sidebar */
.sidebar {
    background: var(--paper-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    height: fit-content;
    position: sticky;
    top: 120px;
}

.sidebar h3 {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 0.5rem;
}

.sidebar a {
    color: var(--text-dark);
    text-decoration: none;
    display: block;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.sidebar a:hover {
    background: var(--secondary-color);
    color: white;
    padding-left: 1rem;
}

/* Article */
.article {
    background: var(--paper-bg);
    padding: 3rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.article::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
}

.article-header {
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.article-title {
    font-family: 'Libre Baskerville', serif;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.article-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-content h2 {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--secondary-color);
}

.article-content h3 {
    font-family: 'Crimson Pro', serif;
    font-size: 1.4rem;
    color: var(--text-dark);
    margin: 1.5rem 0 0.75rem 0;
}

.article-content p {
    margin-bottom: 1rem;
}

.article-content ul, .article-content ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content code {
    font-family: 'IBM Plex Mono', monospace;
    background: #f5f2e8;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    color: #c7254e;
}

.article-content pre {
    background: #2a2a2a;
    color: #f8f8f2;
    padding: 1.5rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: 'IBM Plex Mono', monospace;
}

/* Revision History */
.revision-list {
    list-style: none;
}

.revision-item {
    background: white;
    padding: 1rem;
    border-left: 4px solid var(--secondary-color);
    margin-bottom: 1rem;
    border-radius: 4px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
}

.revision-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--primary-color);
}

.revision-item.selected {
    background: #f0fdf4;
    border-left-color: var(--accent-color);
}

.revision-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.revision-number {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.revision-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.revision-author {
    font-weight: 600;
    color: var(--accent-color);
}

.revision-summary {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.95rem;
}

/* Diff Display */
.diff-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 2rem;
    overflow-x: auto;
}

.diff-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.diff-legend {
    display: flex;
    gap: 2rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

.legend-add {
    background: var(--diff-add);
    border: 1px solid var(--diff-add-text);
}

.legend-remove {
    background: var(--diff-remove);
    border: 1px solid var(--diff-remove-text);
}

.diff-output {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.diff-output table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
}

.diff-output th {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
}

.diff-output td {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    vertical-align: top;
}

.diff-output .diff_add {
    background: var(--diff-add);
    color: var(--diff-add-text);
}

.diff-output .diff_chg {
    background: #fff3cd;
    color: #856404;
}

.diff-output .diff_sub {
    background: var(--diff-remove);
    color: var(--diff-remove-text);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Crimson Pro', serif;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}

.form-textarea {
    min-height: 300px;
    font-family: 'IBM Plex Mono', monospace;
    line-height: 1.6;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    animation: modalFadeIn 0.3s ease;
}

#viewhistory {
	background: blue;
	color:white;
	border: 2px solid black;
}

#compareBtn {
	background: blue;
	color:white;
	border: 2px solid black;
}


@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--paper-bg);
    padding: 2rem;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.modal-title {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.8rem;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-dark);
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(44, 95, 45, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(44, 95, 45, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

/* Alert Messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-success {
    background: var(--diff-add);
    color: var(--diff-add-text);
    border: 1px solid var(--diff-add-text);
}

.alert-error {
    background: var(--diff-remove);
    color: var(--diff-remove-text);
    border: 1px solid var(--diff-remove-text);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #0c5460;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
    
    .article {
        padding: 1.5rem;
    }
    
    .article-title {
        font-size: 2rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .modal-content {
        width: 95%;
        padding: 1rem;
    }
}

/* Print Styles */
@media print {
    .site-header,
    .sidebar,
    .article-actions,
    .btn {
        display: none;
    }
    
    .article {
        box-shadow: none;
        border: none;
    }
}

/* Dark Mode Toggle Switch */
.theme-toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: 0.4s;
    border-radius: 30px;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.theme-slider:before {
    position: absolute;
    content: "☀️";
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

input:checked + .theme-slider {
    background-color: rgba(90, 159, 93, 0.4);
}

input:checked + .theme-slider:before {
    transform: translateX(30px);
    content: "🌙";
}

.theme-slider:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

input:checked + .theme-slider:hover {
    background-color: rgba(90, 159, 93, 0.5);
}

/* Markdown Help Box */
.markdown-help {
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 1.5rem;
    margin-top: 1rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
}

.markdown-help h4 {
    font-family: 'Libre Baskerville', serif;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.markdown-help .help-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 2rem;
}

.markdown-help .help-item {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
}

.markdown-help .help-syntax {
    color: var(--accent-color);
    font-weight: 600;
    min-width: 150px;
}

.markdown-help .help-desc {
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .markdown-help .help-grid {
        grid-template-columns: 1fr;
    }
}
