* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e7ec 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px 10px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
}

header {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.3);
    color: white;
}

h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 400;
}

.viewer-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    overflow: hidden;
    width: 100%;
}

.pdf-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
    gap: 12px;
}

.page-info {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    text-align: center;
}

.nav-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    width: 100%;
    max-width: 300px;
}

.nav-buttons button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    flex: 1;
    min-width: 120px;
}

.nav-buttons button:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.nav-buttons button:active {
    transform: translateY(-1px);
}

.nav-buttons button:disabled {
    background: linear-gradient(135deg, #c3cfe2 0%, #a5b1c2 100%);
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(195, 207, 226, 0.4);
}

.pdf-canvas-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 100%;
    overflow: hidden;
    min-height: 400px;
    position: relative;
}

.pdf-page {
    background: white;
    border-radius: 10px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
    margin: 0 auto 15px auto;
    position: relative;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
}

.pdf-page canvas {
    width: 100% !important;
    height: auto !important;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    max-width: 100%;
}

.page-number {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(45, 55, 72, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.security-notice {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    border-radius: 10px;
    margin-top: 20px;
    font-size: 0.9rem;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.loading {
    text-align: center;
    padding: 60px 30px;
    font-size: 1.2rem;
    color: #4a5568;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    width: 100%;
}

.loading::after {
    content: '';
    display: block;
    width: 50px;
    height: 50px;
    border: 5px solid transparent;
    border-top: 5px solid #667eea;
    border-right: 5px solid #5a67d8;
    border-bottom: 5px solid #4c51bf;
    border-left: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    margin: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-bottom: 12px;
    font-size: 1.3rem;
    font-weight: 700;
}

.error {
    text-align: center;
    padding: 30px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    border-radius: 10px;
    margin: 15px 0;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    width: 100%;
}

.success {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    border-radius: 10px;
    margin-top: 20px;
    font-size: 0.9rem;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 8px;
    margin: 15px 0;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 300px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.4);
}

footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    font-size: 0.85rem;
    color: #718096;
    border-top: 1px solid #e2e8f0;
}

/* Loading state */
.pdf-canvas-container:empty::after {
    content: 'Loading PDF...';
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #666;
    font-style: italic;
}


/* Add to Cart Button */
.add-to-cart {
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border: none;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    transition: 0.3s;
    display: inline-block;
    text-align: center;
}

.add-to-cart:hover {
    background: #218838;
}


/* Mobile-specific PDF rendering improvements */
@media (max-width: 768px) {
    body {
        padding: 15px 8px;
    }
    
    .container {
        padding: 15px;
        border-radius: 12px;
    }
    
    .pdf-page {
        margin: 0 auto 12px auto;
        width: 100%;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }
    
    .pdf-page canvas {
        width: 100% !important;
        height: auto !important;
    }
    
    .viewer-container {
        padding: 12px;
    }
    
    .pdf-canvas-container {
        min-height: 350px;
        gap: 15px;
    }
    
    .page-number {
        font-size: 0.75rem;
        padding: 5px 10px;
        bottom: 8px;
        right: 8px;
    }
    
    .pdf-controls {
        padding: 12px;
    }
    
.nav-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.nav-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(45deg, #6a11cb, #2575fc);
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.nav-buttons button:disabled {
    background: #cccccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Mobile specific */
@media (max-width: 768px) {
    .nav-buttons {
        flex-direction: row; /* This is the key change */
        width: 100%;
        gap: 10px;
    }
    
    .nav-buttons button {
        width: 50%; /* Each button takes half width */
        flex: 1; /* Equal width */
    }
}
    
    h1 {
        font-size: 1.8rem;
    }
    
    .loading::after {
        width: 45px;
        height: 45px;
    }
    
    header {
        padding: 15px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    body {
        padding: 10px 5px;
    }
    
    .container {
        padding: 12px;
        border-radius: 10px;
    }
    
    .pdf-page {
        border-radius: 8px;
    }
    
    .pdf-canvas-container {
        min-height: 300px;
        gap: 12px;
    }
    
    header {
        padding: 12px;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .loading {
        padding: 40px 15px;
    }
    
    .loading::after {
        width: 40px;
        height: 40px;
    }
    
    .viewer-container {
        padding: 10px;
    }
}

/* High DPI screen support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .pdf-page canvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Large screens */
@media (min-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 25px;
    }
}

@media (min-width: 1400px) {
    body {
        padding: 25px 15px;
    }
    
    .container {
        max-width: 100%;
    }
}