/* PDFSwift Styles */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background-color: var(--bg-white);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Promo Banner */
.promo-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    position: relative;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.promo-banner strong {
    color: #fff;
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.5);
}

@media (max-width: 768px) {
    .promo-banner p {
        font-size: 0.85rem !important;
    }
    .promo-banner span {
        display: block;
        margin-left: 0 !important;
        margin-top: 4px;
    }
}

/* Navigation */
.navbar {
    background: var(--bg-white);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand i {
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-mobile {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.mobile-menu {
    display: none;
    background: var(--bg-white);
    box-shadow: var(--shadow);
    padding: 1rem;
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    z-index: 999;
}

.mobile-menu.active {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mobile-menu a {
    text-decoration: none;
    color: var(--text-dark);
    padding: 0.5rem;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-large {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-large {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
    text-align: center;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

.hero-cta {
    margin-top: 2rem;
}

.hero-note {
    margin-top: 1rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Tools Section */
.tools-section {
    padding: 5rem 0;
    background: var(--bg-light);
}

.tools-section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.tool-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.tool-card.premium {
    border: 2px solid var(--primary-color);
    position: relative;
}

.tool-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.tool-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.tool-card p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.pro-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
}

/* Features Section */
.features-section {
    padding: 5rem 0;
}

.features-section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
}

.feature {
    text-align: center;
}

.feature i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature h3 {
    margin-bottom: 0.5rem;
}

.feature p {
    color: var(--text-light);
}

/* Pricing Section */
.pricing-section {
    padding: 5rem 0;
    background: var(--bg-light);
}

.pricing-section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.pricing-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 3rem;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--bg-white);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    position: relative;
}

.pricing-card.featured {
    border: 3px solid var(--primary-color);
    transform: scale(1.05);
}

.popular-badge {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 0.4rem 1.5rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.pricing-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.price {
    margin-bottom: 0.5rem;
}

.price-amount {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
}

.price-period {
    color: var(--text-light);
}

.price-note {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.features-list {
    list-style: none;
    margin-bottom: 2rem;
}

.features-list li {
    padding: 0.6rem 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.features-list i.fa-check {
    color: var(--success-color);
}

.features-list i.fa-times {
    color: var(--text-light);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    overflow-y: auto;
    padding: 2rem;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideDown 0.3s;
}

.modal-small {
    max-width: 450px;
}

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

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

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}

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

.modal-body {
    padding: 2rem;
}

/* Upload Area */
.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: var(--bg-light);
}

.upload-icon {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-area h3 {
    margin-bottom: 0.5rem;
}

.upload-area p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.file-input {
    display: none;
}

/* Processing */
.processing {
    text-align: center;
    padding: 2rem;
}

.spinner {
    border: 4px solid var(--bg-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results */
.conversion-result {
    text-align: center;
}

.result-icon {
    font-size: 4rem;
    color: var(--success-color);
    margin-bottom: 1rem;
}

.result-files {
    margin: 2rem 0;
}

.result-file {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-preview {
    max-width: 200px;
    border-radius: 4px;
    margin: 1rem auto;
}

/* Usage Tracker */
.usage-tracker {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
}

.usage-bar {
    background: var(--border-color);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.usage-fill {
    background: var(--primary-color);
    height: 100%;
    transition: width 0.3s;
}

.upgrade-prompt {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    margin: 2rem 0;
}

.upgrade-prompt h3 {
    margin-bottom: 1rem;
}

/* Auth Forms */
.auth-form {
    max-width: 400px;
    margin: 0 auto;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-switch {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-light);
}

.form-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid var(--success-color);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid var(--danger-color);
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: white;
    padding: 3rem 0 1rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-col h4 {
    margin-bottom: 1rem;
}

.footer-col a {
    display: block;
    color: var(--text-light);
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.footer-col a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid var(--secondary-color);
    padding-top: 1rem;
    text-align: center;
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-mobile {
        display: block;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .pricing-card.featured {
        transform: scale(1);
    }

    .tools-grid,
    .features-grid,
    .pricing-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   WORKSHEET GENERATOR / TEMPLATE EDITOR STYLES
   ============================================ */

/* Template Selection */
.template-selection {
    padding: 1rem 0;
}

.template-header {
    text-align: center;
    margin-bottom: 2rem;
}

.template-header h3 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.template-header p {
    color: var(--text-light);
    font-size: 1rem;
}

.template-upload-section {
    margin-bottom: 2rem;
}

.template-upload-section .upload-area {
    background: var(--bg-light);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.template-upload-section .upload-area:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.template-upload-section .upload-area i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.template-upload-section .upload-area h4 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.template-upload-section .upload-area p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.template-divider {
    text-align: center;
    margin: 2rem 0;
    position: relative;
}

.template-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.template-divider span {
    background: white;
    padding: 0 1rem;
    position: relative;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 600;
}

.template-categories {
    margin-top: 2rem;
}

.template-category {
    margin-bottom: 2.5rem;
}

.template-category h4 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.template-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.template-card .template-icon {
    width: 60px;
    height: 60px;
    background: var(--bg-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: var(--primary-color);
    font-size: 1.8rem;
    transition: all 0.3s ease;
}

.template-card:hover .template-icon {
    background: var(--primary-color);
    color: white;
}

.template-card h5 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.template-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Template Editor */
.template-editor {
    padding: 1rem 0;
}

.editor-header {
    margin-bottom: 1.5rem;
}

.editor-header h3 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.editor-header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.editor-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
    flex-wrap: wrap;
}

.editor-toolbar button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editor-preview {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    min-height: 500px;
    max-height: 700px;
    overflow-y: auto;
}

/* Template Content Styling */
.template-content {
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Times New Roman', serif;
    line-height: 1.8;
}

.template-title {
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    border: none;
    outline: none;
}

.template-title:focus {
    background: #fffbeb;
    border-radius: 4px;
}

.template-subtitle {
    font-size: 1rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-light);
    border: none;
    outline: none;
}

.template-subtitle:focus {
    background: #fffbeb;
    border-radius: 4px;
}

.template-section {
    margin-bottom: 2rem;
    position: relative;
}

.section-content {
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.section-content:focus {
    background: #fffbeb;
    outline: 2px solid var(--primary-color);
}

/* Questions Section */
.questions-section {
    margin-top: 1.5rem;
}

.questions-list {
    list-style: none;
}

.question-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.question-item:hover {
    background: var(--bg-light);
}

.question-number {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 30px;
}

.question-content {
    flex: 1;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.question-content:focus {
    background: #fffbeb;
    outline: 2px solid var(--primary-color);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-icon:hover {
    background: var(--danger-color);
    color: white;
}

/* Vocabulary Section */
.vocab-section {
    margin-top: 1.5rem;
}

.vocab-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.vocab-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.vocab-item:hover {
    box-shadow: var(--shadow);
}

.vocab-word {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    padding: 0.25rem;
    border-radius: 4px;
}

.vocab-word:focus {
    background: #fffbeb;
    outline: 2px solid var(--primary-color);
}

.vocab-definition {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    padding: 0.25rem;
    border-radius: 4px;
}

.vocab-definition:focus {
    background: #fffbeb;
    outline: 2px solid var(--primary-color);
}

.vocab-sentence {
    color: var(--text-light);
    font-style: italic;
    padding: 0.25rem;
    border-radius: 4px;
}

.vocab-sentence:focus {
    background: #fffbeb;
    outline: 2px solid var(--primary-color);
}

/* Field Section (for lab reports, etc.) */
.field-section {
    margin-top: 1.5rem;
}

.field-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    padding: 0.25rem;
    border-radius: 4px;
}

.field-label:focus {
    background: #fffbeb;
    outline: 2px solid var(--primary-color);
}

.field-lines {
    margin-top: 0.5rem;
}

.field-line {
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-family: monospace;
}

/* Page Preview (for uploaded PDFs) */
.page-preview {
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.page-background {
    position: relative;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: 0 auto;
}

.editable-element {
    position: absolute;
    padding: 2px 4px;
    border: 1px solid transparent;
    border-radius: 2px;
    transition: all 0.2s ease;
    cursor: text;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.editable-element:hover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
}

.editable-element:focus {
    background: #fffbeb;
    outline: 2px solid var(--primary-color);
    border-color: transparent;
}

/* Template Image */
.template-image {
    display: block;
    margin: 1rem auto;
    max-width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

/* Loading state */
.loading {
    text-align: center;
    padding: 3rem;
}

.loading i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.loading p {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Responsive adjustments for template editor */
@media (max-width: 768px) {
    .editor-toolbar {
        flex-direction: column;
    }

    .editor-toolbar button {
        width: 100%;
        justify-content: center;
    }

    .template-grid {
        grid-template-columns: 1fr;
    }

    .template-content {
        font-size: 0.9rem;
    }

    .template-title {
        font-size: 1.5rem;
    }

    .question-item {
        flex-direction: column;
        gap: 0.5rem;
    }
}
