.proposal-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header */
.proposal-header {
    display: flex;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.client-logo {
    margin-right: 30px;
    flex-shrink: 0;
}

.client-logo img {
    max-width: 120px;
    max-height: 80px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.proposal-meta {
    flex: 1;
}

.proposal-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.client-name {
    font-size: 1.2rem;
    color: #666;
    margin: 0;
    font-weight: 400;
}

/* PDF Viewer */
.pdf-viewer-container {
    min-height: 600px;
    position: relative;
    margin-bottom: 100px; /* Space for floating button */
}

.pdf-viewer-wrapper {
    min-height: 600px;
    position: relative;
    margin-bottom: 100px;
}

.google-pdf-viewer {
    width: 100%;
    min-height: 800px;
    height: calc(100vh - 250px);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    background: white;
}

.google-pdf-viewer iframe {
    width: 100%;
    height: 100%;
    display: block;
}

@media (max-width: 768px) {
    .google-pdf-viewer {
        min-height: 600px;
        height: calc(100vh - 200px);
    }
}

.pdf-loading,
.pdf-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.pdf-container {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.pdf-page {
    width: 100% !important;
    max-width: unset;
    height: auto !important;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    background: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    
    /* Critical for mobile high-DPI */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
    image-rendering: crisp-edges;
    
    /* Prevent blurry scaling */
    -ms-interpolation-mode: nearest-neighbor;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
    -webkit-transform: translate3d(0,0,0);
    transform: translate3d(0,0,0);

    /* Safari-specific optimizations */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* For high-DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .pdf-page {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Specific optimizations for high-DPI mobile */
@media (-webkit-min-device-pixel-ratio: 3), (min-resolution: 288dpi) {
    .pdf-page {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: pixelated;
    }
}

/* Safari-specific rendering */
@supports (-webkit-appearance: none) {
    .pdf-page {
        image-rendering: -webkit-optimize-contrast;
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* Non-Safari browsers */
@supports not (-webkit-appearance: none) {
    .pdf-page {
        image-rendering: crisp-edges;
        image-rendering: pixelated;
    }
}

.pdf-page:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.proposal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 20px;
}

.proposal-header-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.proposal-actions {
    flex-shrink: 0;
}

.download-button-header {
    display: inline-flex;
    align-items: center;
    padding: 12px 20px;
    background: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.download-button-header:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.download-button-header .dashicons {
    margin-right: 6px;
    font-size: 16px;
    line-height: 1;
}

/* Error State */
.pdf-error {
    background: #fff2f2;
    border: 1px solid #ffcccc;
    border-radius: 8px;
    color: #d63638;
    padding: 40px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .proposal-container {
        padding: 15px;
    }
    
    .proposal-header {
        flex-direction: column;
        text-align: center;
        margin-bottom: 30px;
    }
    
    .client-logo {
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    .proposal-title {
        font-size: 2rem;
    }
    
    .client-name {
        font-size: 1.1rem;
    }
    
    .pdf-page {
        width: 100%;
        height: auto;
    }
    
    .download-button {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .download-button-container {
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    .proposal-title {
        font-size: 1.5rem;
    }
    
    .client-name {
        font-size: 1rem;
    }
    
    .download-button {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Print Styles */
@media print {
    .download-button-container {
        display: none;
    }
    
    .proposal-container {
        max-width: none;
        padding: 0;
    }
    
    .pdf-page {
        box-shadow: none;
        page-break-after: always;
        width: 100% !important;
        height: auto !important;
    }
    
    .pdf-page:last-child {
        page-break-after: auto;
    }
}