/* CSS Variables for theming */
:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #95a5a6;
    --success-color: #27ae60;
    --success-dark: #219a52;
    --background-color: #f5f7fa;
    --surface-color: #ffffff;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #e0e6ed;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* App container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.logo {
    height: 40px;
    width: auto;
}

.app-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.tagline {
    margin-top: 0.5rem;
    opacity: 0.9;
    font-size: 1rem;
}

/* Main content */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
}

/* Panels */
.editor-panel,
.preview-panel {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-panel {
    grid-row: span 2;
}

.controls-panel {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Editor */
.editor-help {
    padding: 0.75rem 1.25rem;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-light);
}

.editor-help code {
    background: #e9ecef;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
}

#markdown-input {
    flex: 1;
    width: 100%;
    padding: 1.25rem;
    border: none;
    resize: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    background: var(--surface-color);
    color: var(--text-color);
}

#markdown-input:focus {
    outline: none;
}

#markdown-input::placeholder {
    color: var(--text-light);
}

/* Controls */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 150px;
}

.control-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

select {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface-color);
    font-size: 0.9rem;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
}

select:hover {
    border-color: var(--primary-color);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.button-group {
    display: flex;
    gap: 0.75rem;
    margin-left: auto;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: #e9ecef;
    color: var(--text-color);
}

.btn-secondary:hover:not(:disabled) {
    background: #dee2e6;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: var(--success-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* Preview */
.preview-container {
    flex: 1;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    overflow: hidden;
}

.preview-placeholder {
    text-align: center;
    color: var(--text-light);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.placeholder-hint {
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Slide styles */
.slide {
    width: 100%;
    height: 100%;
    max-width: 800px;
    aspect-ratio: 16 / 9;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: auto;
}

.slide h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.slide h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.slide h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.slide p {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.slide ul, .slide ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.slide li {
    margin-bottom: 0.4rem;
}

.slide code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.slide pre {
    background: rgba(0, 0, 0, 0.1);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1rem;
}

.slide pre code {
    background: none;
    padding: 0;
}

.slide blockquote {
    border-left: 4px solid currentColor;
    padding-left: 1rem;
    margin: 1rem 0;
    opacity: 0.8;
    font-style: italic;
}

.slide img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.slide a {
    color: inherit;
    text-decoration: underline;
}

/* Slide navigation */
.slide-navigation {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#slide-counter, #fs-counter {
    font-size: 0.9rem;
    color: var(--text-light);
    min-width: 60px;
    text-align: center;
}

.nav-btn {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface-color);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover:not(:disabled) {
    background: var(--background-color);
    border-color: var(--primary-color);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Theme variations for slides */
.slide.theme-default {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.slide.theme-dark {
    background: linear-gradient(135deg, #2c3e50, #1a252f);
    color: #ecf0f1;
}

.slide.theme-light {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    color: #2c3e50;
    border: 1px solid var(--border-color);
}

.slide.theme-nature {
    background: linear-gradient(135deg, #27ae60, #1e8449);
    color: white;
}

.slide.theme-sunset {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.slide.theme-professional {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: #ecf0f1;
}

.slide.theme-creative {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
}

/* Font variations */
.slide.font-serif {
    font-family: 'Georgia', 'Times New Roman', serif;
}

.slide.font-mono {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
}

.slide.font-system {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0.7;
    transition: var(--transition);
    z-index: 10;
}

.close-btn:hover {
    opacity: 1;
}

.fullscreen-slide {
    width: 100%;
    max-width: 1200px;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-slide .slide {
    width: 100%;
    height: 100%;
    max-width: none;
    font-size: 1.5rem;
}

.fullscreen-slide .slide h1 {
    font-size: 3rem;
}

.fullscreen-slide .slide h2 {
    font-size: 2.25rem;
}

.fullscreen-slide .slide h3 {
    font-size: 1.75rem;
}

.fullscreen-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.fullscreen-nav .nav-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.fullscreen-nav .nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}

#fs-counter {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
}

.fullscreen-hint {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

/* Footer */
.app-footer {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 1rem 2rem;
    text-align: center;
}

.app-footer p {
    font-size: 0.9rem;
    color: var(--text-light);
}

.app-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.app-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }

    .editor-panel {
        grid-row: span 1;
        min-height: 300px;
    }

    .preview-panel {
        min-height: 400px;
    }

    .controls-panel {
        justify-content: center;
    }

    .button-group {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .app-header {
        padding: 1rem;
    }

    .app-header h1 {
        font-size: 1.25rem;
    }

    .tagline {
        font-size: 0.85rem;
    }

    .main-content {
        padding: 1rem;
        gap: 1rem;
    }

    .panel-header {
        padding: 0.75rem 1rem;
    }

    .editor-help {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    #markdown-input {
        padding: 1rem;
        font-size: 0.85rem;
    }

    .controls-panel {
        padding: 1rem;
    }

    .control-group {
        min-width: 100%;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .slide {
        padding: 1.5rem;
    }

    .slide h1 {
        font-size: 1.5rem;
    }

    .slide h2 {
        font-size: 1.25rem;
    }

    .slide p, .slide li {
        font-size: 0.9rem;
    }

    .fullscreen-slide .slide {
        font-size: 1rem;
    }

    .fullscreen-slide .slide h1 {
        font-size: 2rem;
    }

    .fullscreen-slide .slide h2 {
        font-size: 1.5rem;
    }

    .app-footer {
        padding: 0.75rem 1rem;
    }

    .app-footer p {
        font-size: 0.8rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide {
    animation: fadeIn 0.3s ease;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}
