/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

header p {
    color: #666;
    font-size: 1.1em;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 1em;
    cursor: pointer;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-btn:hover {
    color: #667eea;
    background: #f5f5f5;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* File Upload */
.file-upload {
    margin: 20px 0;
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border: 3px dashed #667eea;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f9f9ff;
}

.file-upload label:hover {
    background: #f0f0ff;
    border-color: #764ba2;
}

.file-upload label span:first-child {
    font-size: 1.2em;
    color: #667eea;
    margin-bottom: 10px;
    font-weight: 600;
}

.file-name {
    font-size: 0.9em;
    color: #999;
}

/* Textarea */
#markdownInput {
    width: 100%;
    min-height: 300px;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 1em;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#markdownInput:focus {
    outline: none;
    border-color: #667eea;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 150px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #764ba2;
    color: white;
}

.btn-secondary:hover {
    background: #653a8a;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(118, 75, 162, 0.3);
}

.btn-outline {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

/* Preview Section */
.preview-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #e0e0e0;
    display: none;
}

.preview-section.active {
    display: block;
}

.preview-section h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.preview-content {
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    min-height: 200px;
}

/* Markdown Content Styles */
.preview-content h1,
.print-only h1 {
    font-size: 2em;
    margin: 20px 0 10px 0;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.preview-content h2,
.print-only h2 {
    font-size: 1.6em;
    margin: 18px 0 8px 0;
    color: #444;
}

.preview-content h3,
.print-only h3 {
    font-size: 1.3em;
    margin: 16px 0 6px 0;
    color: #555;
}

.preview-content p,
.print-only p {
    margin: 10px 0;
}

.preview-content ul,
.preview-content ol,
.print-only ul,
.print-only ol {
    margin: 10px 0;
    padding-left: 30px;
}

.preview-content li,
.print-only li {
    margin: 5px 0;
}

.preview-content code,
.print-only code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.preview-content pre,
.print-only pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 15px 0;
}

.preview-content pre code,
.print-only pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.preview-content blockquote,
.print-only blockquote {
    border-left: 4px solid #667eea;
    padding-left: 20px;
    margin: 15px 0;
    color: #666;
    font-style: italic;
}

.preview-content a,
.print-only a {
    color: #667eea;
    text-decoration: none;
}

.preview-content a:hover {
    text-decoration: underline;
}

.preview-content img,
.print-only img {
    max-width: 100%;
    height: auto;
    margin: 15px 0;
}

.preview-content table,
.print-only table {
    border-collapse: collapse;
    width: 100%;
    margin: 15px 0;
}

.preview-content th,
.preview-content td,
.print-only th,
.print-only td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.preview-content th,
.print-only th {
    background: #f5f5f5;
    font-weight: 600;
}

/* Print Only Area (hidden on screen) */
.print-only {
    display: none;
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        display: none;
    }

    .print-only {
        display: block;
        padding: 20px;
    }

    .print-only a {
        color: #000;
        text-decoration: underline;
    }

    .print-only a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }

    @page {
        margin: 2cm;
    }
}