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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-brand h2 {
    color: #ff6b35;
    font-weight: bold;
}

.nav-brand a {
    text-decoration: none;
    color: inherit;
}

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

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
}



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

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.get-started-btn {
    background: #ff6b35;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
}

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

.tool-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-5px);
}

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

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

.tool-card p {
    color: #666;
    font-size: 0.9rem;
}

a.tool-card {
    text-decoration: none;
    color: inherit;
}

.merge-hero {
    text-align: center;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.merge-hero h1 {
    font-size: 1rem;
    margin-bottom: 0.1rem;
}

.merge-hero p {
    font-size: 0.7rem;
    margin: 0;
}

.merge-tool {
    max-width: 800px;
    margin: 3rem auto;
    padding: 0;
}

.upload-area {
    margin-bottom: 2rem;
}

.upload-box {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    background: #f9f9f9;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-btn {
    background: #ff6b35;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
}

.file-list {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.file-item {
    padding: 0.5rem;
    margin: 0.5rem 0;
    background: #f0f0f0;
    border-radius: 6px;
}

.merge-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    width: 100%;
}

.preview-section {
    margin-top: 2rem;
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.page-preview {
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 0.5rem;
    background: white;
    position: relative;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: #666;
}

.remove-page-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-preview canvas {
    width: 100%;
    height: auto;
    border: 1px solid #eee;
    border-radius: 4px;
}

.add-more-section {
    margin: 2rem 0;
    text-align: center;
}

.add-more-box {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 2rem;
    background: #f9f9f9;
    display: inline-block;
    min-width: 300px;
}

.add-more-box h4 {
    margin: 0.5rem 0;
    color: #666;
}

.add-more-box .upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.add-more-box .upload-btn {
    width: auto;
    padding: 0.75rem 1.5rem;
}

.file-info {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.file-info #fileName {
    padding: 1rem;
    margin: 1rem 0;
    background: #f0f0f0;
    border-radius: 6px;
    font-size: 1.1rem;
}

.edit-container {
    display: flex;
    min-height: calc(100vh - 200px);
}

.sidebar {
    width: 250px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    padding: 1rem;
    overflow-y: auto;
}

.sidebar h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.1rem;
}

.pages-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.page-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0,123,255,0.1);
}

.page-number {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.3rem;
    text-align: center;
}

.page-canvas {
    text-align: center;
}

.page-canvas canvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #eee;
    border-radius: 3px;
}

.main-content {
    flex: 1;
    padding: 0 2rem;
}

.pdf-viewer {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

.page-header h3 {
    margin: 0;
    color: #333;
}

.download-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.download-btn:hover {
    background: #218838;
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem 0;
    overflow: auto;
    position: relative;
}

#mainCanvas {
    border: 1px solid #dee2e6;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background: white;
    cursor: crosshair;
}

.text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.text-input {
    position: absolute;
    border: 2px solid #007bff;
    background: white;
    padding: 2px 4px;
    font-size: 14px;
    z-index: 10;
    pointer-events: all;
}

.text-element {
    position: absolute;
    background: rgba(255, 255, 0, 0.3);
    padding: 2px 4px;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid transparent;
    pointer-events: all;
}

.text-element:hover {
    border-color: #007bff;
    background: rgba(255, 255, 0, 0.5);
}

.page-item.active {
    border-color: #007bff;
    background-color: #e3f2fd;
}

