:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #f3f4f6;
    --accent-color: #10b981;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --background: #ffffff;
    --background-alt: #f9fafb;
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background: var(--background);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-light);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: var(--transition);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo h2 {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    margin: 3px 0;
    transition: var(--transition);
    border-radius: 2px;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 120px 0 80px;
    text-align: center;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 3rem;
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.feature-icon {
    font-size: 1.25rem;
}

/* Print Section */
.print-section {
    padding: 80px 0;
    background: var(--background-alt);
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-header p {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.print-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.option-card {
    background: var(--background);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 2px solid transparent;
}

.option-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.option-card.active {
    border-color: var(--primary-color);
}

.option-header {
    text-align: center;
    margin-bottom: 2rem;
}

.option-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.option-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.option-header p {
    color: var(--text-secondary);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--background-alt);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--background-alt);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.upload-text {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.browse-text {
    color: var(--primary-color);
    font-weight: 600;
}

.upload-info {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* File Preview */
.file-preview {
    background: var(--background-alt);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.file-icon {
    font-size: 2rem;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.remove-file {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
}

.remove-file:hover {
    color: #ef4444;
}

/* Text Area */
.text-area-container {
    position: relative;
}

#text-content {
    width: 100%;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: var(--transition);
}

#text-content:focus {
    outline: none;
    border-color: var(--primary-color);
}

.text-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    gap: 1rem;
}

.text-action-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Template Selector */
.template-selector-container {
    margin-bottom: 1.5rem;
}

.template-selector {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    cursor: pointer;
}

.template-selector:focus {
    outline: none;
    border-color: var(--primary-color);
}

.template-selector:hover {
    border-color: var(--accent-color);
}

/* Buttons */
.print-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.print-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.print-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

.clear-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.clear-btn:hover {
    background: var(--background-alt);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-primary);
    border: none;
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Print Preview */
.print-preview {
    background: var(--background);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-top: 2rem;
    max-width: none;
    width: 100%;
}

.print-preview h3 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    color: var(--text-primary);
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

.preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.2rem;
    background: var(--background-alt);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.preview-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.preview-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.preview-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.font-options select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--background);
    color: var(--text-primary);
    font-family: inherit;
}

.preview-content {
    background: var(--background);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    min-height: 400px;
    border: 1px solid var(--border-color);
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-y: auto;
    max-height: 600px;
}

/* Enhanced preview content styling for expanded view */
.preview-content.expanded {
    max-height: none !important;
    min-height: 500px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    font-size: 15px;
    line-height: 1.7;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.preview-content.url-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    white-space: normal;
    word-wrap: break-word;
}

.preview-content.url-content.expanded {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--background);
    max-width: none;
}

.preview-content.url-content h1,
.preview-content.url-content h2,
.preview-content.url-content h3,
.preview-content.url-content h4,
.preview-content.url-content h5,
.preview-content.url-content h6 {
    color: var(--primary-color);
    margin: 1.5rem 0 0.75rem 0;
    font-weight: 600;
    line-height: 1.3;
}

.preview-content.url-content h1 { font-size: 2rem; }
.preview-content.url-content h2 { font-size: 1.5rem; }
.preview-content.url-content h3 { font-size: 1.25rem; }
.preview-content.url-content h4 { font-size: 1.125rem; }

.preview-content.url-content.expanded h1 {
    font-size: 2.2rem;
    margin: 2rem 0 1rem 0;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.preview-content.url-content.expanded h2 {
    font-size: 1.7rem;
    margin: 1.8rem 0 0.8rem 0;
    color: var(--primary-color);
}

.preview-content.url-content.expanded h3 {
    font-size: 1.4rem;
    margin: 1.5rem 0 0.7rem 0;
    color: var(--text-primary);
}

.preview-content.url-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.preview-content.url-content.expanded p {
    margin-bottom: 1.2rem;
    text-align: left;
    line-height: 1.7;
}

.preview-content.url-content ul,
.preview-content.url-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.preview-content.url-content.expanded ul,
.preview-content.url-content.expanded ol {
    margin: 1.2rem 0;
    padding-left: 2.5rem;
}

.preview-content.url-content li {
    margin-bottom: 0.5rem;
}

.preview-content.url-content.expanded li {
    margin-bottom: 0.7rem;
    line-height: 1.6;
}

.preview-content.url-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.preview-content.url-content.expanded a {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
}

.preview-content.url-content.expanded a:hover {
    color: var(--primary-dark);
    text-decoration-thickness: 2px;
}

.preview-content.url-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
}

.preview-content.url-content.expanded img {
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    display: block;
}

.preview-content.url-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    background: var(--background-alt);
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 0 6px 6px 0;
}

.preview-content.url-content.expanded blockquote {
    border-left: 4px solid var(--primary-color);
    margin: 1.5rem 0;
    padding: 1.2rem 1.5rem;
    background: var(--background-alt);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.preview-content.url-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.preview-content.url-content.expanded table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: var(--background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.preview-content.url-content th,
.preview-content.url-content td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.preview-content.url-content.expanded th,
.preview-content.url-content.expanded td {
    border: 1px solid var(--border-color);
    padding: 1rem;
    text-align: left;
}

.preview-content.url-content th {
    background: var(--background-alt);
    font-weight: 600;
}

.preview-content.url-content.expanded th {
    background: var(--background-alt);
    font-weight: 600;
    color: var(--text-primary);
}

/* Clean text mode styling */
.preview-content.clean-text {
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    background: var(--background-alt);
}

.preview-content.clean-text.expanded {
    font-family: 'Georgia', 'Times New Roman', serif;
    white-space: pre-wrap;
    background: var(--background-alt);
    font-size: 14px;
    line-height: 1.8;
    padding: 2.5rem;
}

/* Template Content Styling */
.preview-content.template-content {
    background: var(--background);
    padding: 0;
    border: none;
    box-shadow: none;
}

.preview-content.template-content.expanded {
    background: var(--background);
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

/* Print-specific styling */
.print-content {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.6;
    color: #000;
    max-width: none;
    padding: 0;
    background: white;
}

.print-content h1,
.print-content h2,
.print-content h3,
.print-content h4,
.print-content h5,
.print-content h6 {
    color: #000;
    page-break-after: avoid;
}

.print-content img {
    max-width: 100%;
    page-break-inside: avoid;
}

.print-content table {
    page-break-inside: avoid;
}

/* Features Section */
.features-section {
    padding: 80px 0;
    background: var(--background);
}

.features-section h2 {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    text-align: center;
    padding: 2rem;
    background: var(--background-alt);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-card .feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-secondary);
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: #d1d5db;
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #9ca3af;
}

/* URL Input Styles */
.url-input-container {
    margin-bottom: 1.5rem;
}

.url-input {
    width: 100%;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    margin-bottom: 1rem;
}

.url-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.url-input:valid {
    border-color: var(--accent-color);
}

.fetch-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
}

.fetch-btn:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-2px);
}

.fetch-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

.fetch-btn.loading {
    background: var(--text-secondary);
    cursor: wait;
}

.fetch-btn.loading::before {
    content: "⏳";
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.url-info {
    margin-bottom: 1.5rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.info-icon {
    font-size: 1rem;
}

/* URL Preview */
.url-preview {
    background: var(--background-alt);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

/* URL preview status enhancements */
.url-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background-alt);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.status-indicator.success {
    background: var(--accent-color);
    animation: pulse-success 2s ease-in-out;
}

@keyframes pulse-success {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

.url-details {
    flex: 1;
}

.fetched-url {
    font-weight: 600;
    margin-bottom: 0.5rem;
    word-break: break-all;
    color: var(--text-primary);
}

.content-type {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Iframe Container */
.iframe-container {
    margin: 1.5rem 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--background);
}

.iframe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--background-alt);
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
}

.iframe-controls {
    display: flex;
    gap: 0.5rem;
}

.iframe-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.iframe-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.iframe-btn:active {
    transform: translateY(0);
}

#content-iframe {
    width: 100%;
    height: 400px;
    border: none;
    display: block;
}

.iframe-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    background: var(--background-alt);
    color: var(--text-secondary);
    font-size: 1rem;
}

.iframe-loading::before {
    content: "⏳";
    margin-right: 0.5rem;
    animation: spin 1s linear infinite;
}

.iframe-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    background: var(--background-alt);
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

.iframe-error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.iframe-error-text {
    margin-bottom: 1rem;
}

.iframe-error-suggestion {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Loading state for fetch button */
.fetch-btn.iframe-mode {
    background: var(--text-secondary);
    cursor: wait;
}

.fetch-btn.iframe-mode::after {
    content: " (Embedding...)";
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Content Container Styles */
.content-container {
    margin: 1.5rem 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--background);
    border: 1px solid var(--border-color);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--background-alt);
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-primary);
}

.content-controls {
    display: flex;
    gap: 0.75rem;
}

.content-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.content-btn:active {
    transform: translateY(0);
}

.content-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

.content-preview {
    max-height: 400px;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--background);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
}

.content-preview h1,
.content-preview h2,
.content-preview h3,
.content-preview h4,
.content-preview h5,
.content-preview h6 {
    color: var(--primary-color);
    margin: 1.5rem 0 0.75rem 0;
    font-weight: 600;
    line-height: 1.3;
}

.content-preview h1 { font-size: 1.8rem; }
.content-preview h2 { font-size: 1.4rem; }
.content-preview h3 { font-size: 1.2rem; }

.content-preview p {
    margin-bottom: 1rem;
    text-align: justify;
}

.content-preview ul,
.content-preview ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.content-preview li {
    margin-bottom: 0.5rem;
}

.content-preview a {
    color: var(--primary-color);
    text-decoration: underline;
}

.content-preview img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
}

.content-preview blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    background: var(--background-alt);
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 0 6px 6px 0;
}

.content-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--background);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.content-preview th,
.content-preview td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.content-preview th {
    background: var(--background-alt);
    font-weight: 600;
    color: var(--text-primary);
}

/* PDF Generation Loading States */
.fetch-btn.generating {
    background: var(--accent-color);
    cursor: wait;
}

.fetch-btn.generating::before {
    content: "📄";
    animation: pulse 1.5s ease-in-out infinite;
}

.content-btn.generating {
    background: var(--text-secondary);
    cursor: wait;
}

.content-btn.generating::before {
    content: "⏳";
    margin-right: 0.5rem;
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

/* Loading overlay for content */
.content-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: var(--background-alt);
    color: var(--text-secondary);
    text-align: center;
}

.content-loading-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    animation: spin 2s linear infinite;
}

.content-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: var(--background-alt);
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

.content-error-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.content-error-text {
    margin-bottom: 1rem;
    font-weight: 500;
}

.content-error-suggestion {
    font-size: 0.875rem;
    color: var(--text-light);
    max-width: 300px;
}

/* PDF iframe container */
.pdf-container {
    width: 100%;
    height: 500px;
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

/* Success states */
.fetch-btn.success {
    background: var(--accent-color);
    animation: pulse-success 1s ease-in-out;
}

.content-btn.success {
    background: var(--accent-color);
    animation: pulse-success 1s ease-in-out;
}

@keyframes pulse-success {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .print-options {
        grid-template-columns: 1fr;
    }
    
    .content-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .content-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .content-btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .content-preview {
        padding: 1rem;
        max-height: 300px;
    }
    
    .content-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .content-btn {
        font-size: 0.875rem;
        padding: 0.65rem 1rem;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--background);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow-md);
        padding: 2rem 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-features {
        flex-direction: column;
        align-items: center;
        max-width: 300px;
        margin: 0 auto;
    }

    .feature {
        width: 100%;
        justify-content: center;
    }

    .print-options {
        grid-template-columns: 1fr;
    }

    .upload-area {
        padding: 2rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .text-actions {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .text-action-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }

    .template-selector {
        font-size: 0.9rem;
        padding: 0.65rem;
    }

    .preview-actions {
        flex-direction: column;
    }

    .iframe-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .iframe-controls {
        width: 100%;
        justify-content: space-between;
    }

    .iframe-btn {
        flex: 1;
        justify-content: center;
    }

    #content-iframe {
        height: 300px;
    }

    .preview-toolbar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .preview-options {
        justify-content: center;
    }
    
    .preview-content {
        padding: 1rem;
        max-height: 400px;
    }

    .preview-content.expanded {
        padding: 1.5rem;
        font-size: 14px;
    }
    
    .preview-content.url-content.expanded h1 {
        font-size: 1.8rem;
    }
    
    .preview-content.url-content.expanded h2 {
        font-size: 1.4rem;
    }
    
    .preview-content.url-content.expanded h3 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .option-card {
        padding: 1.5rem;
    }

    .upload-area {
        padding: 1.5rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .text-action-buttons {
        gap: 0.5rem;
    }
    
    .btn-secondary,
    .print-btn {
        font-size: 0.9rem;
        padding: 0.65rem 1.25rem;
    }
}

@media (max-width: 1024px) {
    .print-options {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .hero,
    .features-section,
    .footer,
    .print-preview,
    .preview-actions {
        display: none !important;
    }

    .print-section {
        padding: 0;
        background: white;
    }

    .preview-content {
        background: white;
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .preview-content.template-content {
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }
    
    .preview-content.template-content * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* Games Page Styles */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.game-card {
    background: var(--background);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    text-align: center;
    border: 2px solid transparent;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.game-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.game-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.game-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.game-options {
    margin-bottom: 1.5rem;
    text-align: left;
}

.game-options label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.game-options select {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--background);
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.game-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.game-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

/* Game Preview */
.game-preview {
    background: var(--background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-top: 3rem;
    overflow: hidden;
}

.preview-header {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.preview-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.preview-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.preview-actions button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.game-content {
    padding: 2rem;
    background: var(--background);
}

/* Games Layout */
.games-layout {
    display: grid;
    gap: 2rem;
}

.games-layout.games-1 {
    grid-template-columns: 1fr;
}

.games-layout.games-2 {
    grid-template-columns: 1fr 1fr;
}

.games-layout.games-3 {
    grid-template-columns: repeat(3, 1fr);
}

.games-layout.games-4 {
    grid-template-columns: repeat(2, 1fr);
}

.games-layout.games-6 {
    grid-template-columns: repeat(3, 1fr);
}

.games-layout.games-9 {
    grid-template-columns: repeat(3, 1fr);
}

/* Tic-Tac-Toe Styles */
.ttt-game {
    text-align: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background-alt);
}

.ttt-grid {
    display: grid;
    gap: 2px;
    background: var(--text-primary);
    margin: 1rem auto;
    width: fit-content;
}

.ttt-3x3 {
    grid-template-columns: repeat(3, 60px);
}

.ttt-4x4 {
    grid-template-columns: repeat(4, 50px);
}

.ttt-5x5 {
    grid-template-columns: repeat(5, 40px);
}

.ttt-cell {
    width: 60px;
    height: 60px;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
}

.ttt-4x4 .ttt-cell {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
}

.ttt-5x5 .ttt-cell {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
}

/* Dots and Boxes Styles */
.dab-game {
    text-align: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background-alt);
}

.dab-grid {
    margin: 1rem auto;
    width: fit-content;
}

.dab-row {
    display: flex;
    align-items: center;
    height: 25px;
}

.dab-dot {
    width: 8px;
    height: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-primary);
}

.dab-h-line {
    width: 30px;
    height: 2px;
    border-bottom: 1px solid var(--border-color);
}

.dab-v-line {
    width: 8px;
    height: 25px;
    border-left: 1px solid var(--border-color);
}

.dab-box {
    width: 30px;
    height: 25px;
}

/* Word Search Styles */
.ws-game {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background-alt);
}

.ws-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.ws-grid {
    display: grid;
    gap: 1px;
    background: var(--text-primary);
    font-family: monospace;
    font-weight: bold;
}

.ws-10x10 {
    grid-template-columns: repeat(10, 25px);
}

.ws-12x12 {
    grid-template-columns: repeat(12, 22px);
}

.ws-15x15 {
    grid-template-columns: repeat(15, 20px);
}

.ws-20x20 {
    grid-template-columns: repeat(20, 18px);
}

.ws-cell {
    width: 25px;
    height: 25px;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.ws-12x12 .ws-cell {
    width: 22px;
    height: 22px;
    font-size: 12px;
}

.ws-15x15 .ws-cell {
    width: 20px;
    height: 20px;
    font-size: 11px;
}

.ws-20x20 .ws-cell {
    width: 18px;
    height: 18px;
    font-size: 10px;
}

.ws-wordlist {
    min-width: 150px;
}

.ws-wordlist h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.ws-words {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ws-word {
    padding: 0.25rem 0.5rem;
    background: var(--background);
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Hangman Styles */
.hm-game {
    text-align: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background-alt);
}

.hm-gallows {
    margin: 1rem 0;
}

.gallows-art {
    font-family: monospace;
    font-size: 12px;
    line-height: 1;
    color: var(--text-primary);
}

.hm-word {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 1rem 0;
}

.hm-blank {
    width: 30px;
    height: 2px;
    border-bottom: 3px solid var(--text-primary);
    display: inline-block;
}

.hm-alphabet {
    margin: 1rem 0;
}

.alphabet-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.hm-letter {
    display: inline-block;
    width: 25px;
    height: 25px;
    border: 1px solid var(--border-color);
    margin: 2px;
    line-height: 23px;
    font-size: 12px;
    background: var(--background);
}

.hm-wrong {
    margin: 1rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Game Info */
.game-info {
    margin-top: 1rem;
    padding: 0.5rem;
    background: var(--background);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

/* Responsive adjustments for games */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .ws-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .preview-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .games-layout.games-2,
    .games-layout.games-3,
    .games-layout.games-4,
    .games-layout.games-6,
    .games-layout.games-9 {
        grid-template-columns: 1fr;
    }
}

@media print {
    .game-preview {
        box-shadow: none;
        border: none;
    }
    
    .preview-header {
        background: white !important;
        color: black !important;
        border-bottom: 2px solid #000;
    }
    
    .preview-actions {
        display: none;
    }
    
    .game-info {
        background: white !important;
        font-size: 8px !important;
    }
}

/* Sudoku Styles */
.sudoku-game {
    text-align: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background-alt);
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 35px);
    grid-template-rows: repeat(9, 35px);
    gap: 1px;
    background: #000;
    margin: 1rem auto;
    width: fit-content;
    border: 3px solid #000;
}

.sudoku-cell {
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
}

.sudoku-cell.dark {
    background: #f8f8f8;
}

/* Add thick borders for 3x3 boxes */
.sudoku-cell:nth-child(3n) {
    border-right: 2px solid #000;
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #000;
}

/* Crossword Styles */
.crossword-game {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background-alt);
}

.crossword-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.crossword-grid {
    display: grid;
    gap: 1px;
    background: #000;
    border: 2px solid #000;
}

.cw-9x9 {
    grid-template-columns: repeat(9, 25px);
}

.cw-13x13 {
    grid-template-columns: repeat(13, 20px);
}

.cw-15x15 {
    grid-template-columns: repeat(15, 18px);
}

.cw-cell {
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.cw-13x13 .cw-cell {
    width: 20px;
    height: 20px;
    font-size: 10px;
}

.cw-15x15 .cw-cell {
    width: 18px;
    height: 18px;
    font-size: 9px;
}

.cw-white {
    background: white;
    border: 1px solid #ccc;
}

.cw-black {
    background: #000;
}

.crossword-clues {
    min-width: 200px;
    max-width: 300px;
}

.clues-section {
    margin-bottom: 1.5rem;
}

.clues-section h5 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-size: 1rem;
}

.clues-list {
    font-size: 0.8rem;
    line-height: 1.4;
}

.clue {
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
}

/* Connect the Dots Styles */
.connect-game {
    text-align: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background-alt);
}

.connect-container {
    margin: 1rem auto;
    max-width: 400px;
}

.connect-svg {
    width: 100%;
    height: 300px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
}

/* Word Scramble Styles */
.scramble-game {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--background-alt);
}

.scramble-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.scramble-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.scramble-number {
    background: var(--primary-color);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    flex-shrink: 0;
}

.scramble-word {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 2px;
    color: var(--primary-color);
    min-width: 100px;
}

.scramble-line {
    border-bottom: 2px solid var(--border-color);
    flex: 1;
    height: 20px;
    letter-spacing: 8px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.scramble-answers {
    margin-top: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.scramble-answers h5 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.answer-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    font-size: 0.8rem;
}

.answer-item {
    color: var(--text-secondary);
}

/* Responsive adjustments for new games */
@media (max-width: 768px) {
    .crossword-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .crossword-clues {
        max-width: 100%;
    }
    
    .scramble-grid {
        grid-template-columns: 1fr;
    }
    
    .answer-list {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sudoku-grid {
        grid-template-columns: repeat(9, 30px);
        grid-template-rows: repeat(9, 30px);
    }
    
    .sudoku-cell {
        font-size: 14px;
    }
}

@media print {
    .scramble-answers {
        page-break-before: always;
    }
    
    .connect-svg {
        background: white !important;
    }
    
    .sudoku-cell,
    .cw-white {
        background: white !important;
    }
}
