/**
 * PDF Viewer & Print Plugin - Frontend Styles
 */

/* Container Styles */
.idz-pdf-viewer-container {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    align-items: center;
    flex-wrap: wrap;
}

/* Button Base Styles */
.idz-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid #ddd;
    background: #f7f7f7;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    transition: all 0.2s ease;
    outline: none;
}

.idz-button:hover {
    background: #e7e7e7;
    border-color: #bbb;
    color: #000;
}

.idz-button:focus {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    border-color: #007cba;
}

.idz-button:active {
    background: #d7d7d7;
    transform: translateY(1px);
}

/* Button Style Variations */
.idz-button.primary {
    background: #007cba;
    color: #fff;
    border-color: #005a87;
}

.idz-button.primary:hover {
    background: #005a87;
    border-color: #004866;
    color: #fff;
}

.idz-button.secondary {
    background: #666;
    color: #fff;
    border-color: #444;
}

.idz-button.secondary:hover {
    background: #555;
    border-color: #333;
    color: #fff;
}

/* Button Icons */
.idz-button-icon {
    font-size: 16px;
    line-height: 1;
}

.idz-button-text {
    font-weight: 500;
}

/* Loading State */
.idz-button.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.idz-button.loading .idz-button-text::after {
    content: '...';
    animation: idz-dots 1.5s infinite;
}

@keyframes idz-dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Widget Specific Styles */
.widget .idz-pdf-viewer-container {
    margin: 10px 0;
}

.widget .idz-button {
    width: 100%;
    justify-content: center;
    margin-bottom: 8px;
}

.widget .idz-button:last-child {
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 600px) {
    .idz-pdf-viewer-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .idz-button {
        justify-content: center;
        width: 100%;
    }
}

/* Print Styles - Dynamic hiding based on admin settings */
@media print {
    /* Always hide buttons during print */
    .idz-pdf-viewer-container {
        display: none !important;
    }
    
    /* Always hide admin elements */
    #wpadminbar,
    div.admin-bar,
    .wp-admin {
        display: none !important;
    }
    
    /* Always hide edit links and skip links for cleaner PDF */
    .post-edit-link,
    .genesis-skip-link,
    .skip-link,
    .screen-reader-shortcut {
        display: none !important;
    }
    
    /* Dynamic hiding classes - applied by JavaScript based on admin settings */
    .idz-hide-header {
        display: none !important;
    }
    
    .idz-hide-footer {
        display: none !important;
    }
    
    .idz-hide-sidebar {
        display: none !important;
    }
    
    .idz-hide-navigation {
        display: none !important;
    }
    
    .idz-hide-comments {
        display: none !important;
    }
    
    /* Print visibility control classes */
    .idz-print-hidden {
        display: none !important;
    }
    
    .idz-print-visible {
        display: block !important;
    }
    
    .idz-print-only {
        display: block !important;
    }
    
    .idz-screen-only {
        display: none !important;
    }
    
    /* Print optimization */
    * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    body {
        margin: 0;
        padding: 20px;
        font-size: 12pt;
        line-height: 1.5;
    }
    
    /* Preserve page titles and entry headers */
    .entry-title,
    .page-title,
    h1.entry-title {
        page-break-after: avoid;
        break-after: avoid;
        margin-top: 0;
        margin-bottom: 1em;
        font-size: 18pt;
        font-weight: bold;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        break-after: avoid;
        margin-top: 1em;
        margin-bottom: 0.5em;
    }
    
    h1 { font-size: 16pt; }
    h2 { font-size: 14pt; }
    h3 { font-size: 13pt; }
    h4 { font-size: 12pt; }
    h5, h6 { font-size: 11pt; }
    
    p {
        margin: 0 0 1em 0;
        orphans: 3;
        widows: 3;
    }
    
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    /* Avoid page breaks inside important elements */
    blockquote,
    table,
    pre,
    code,
    .wp-block-quote,
    .wp-block-table {
        page-break-inside: avoid;
        break-inside: avoid;
        margin: 1em 0;
    }
    
    /* Lists */
    ul, ol {
        page-break-inside: avoid;
        break-inside: avoid;
        margin: 1em 0;
        padding-left: 2em;
    }
    
    li {
        margin: 0.25em 0;
    }
    
    /* Links */
    a {
        color: #000 !important;
        text-decoration: underline;
    }
    
    /* Tables */
    table {
        border-collapse: collapse;
        width: 100%;
        margin: 1em 0;
    }
    
    th, td {
        border: 1px solid #000;
        padding: 0.5em;
        text-align: left;
    }
    
    th {
        font-weight: bold;
        background: #f0f0f0 !important;
    }
}

/* Screen-only styles */
@media screen {
    .idz-print-only {
        display: none !important;
    }
    
    .idz-screen-only {
        display: block !important;
    }
}

/* Error Messages */
.idz-error-message {
    background: #ffebee;
    border: 1px solid #f44336;
    color: #c62828;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

/* Success Messages */
.idz-success-message {
    background: #e8f5e8;
    border: 1px solid #4caf50;
    color: #2e7d32;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

/* Accessibility Improvements */
.idz-button:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .idz-button {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .idz-button {
        transition: none;
    }
    
    .idz-button:active {
        transform: none;
    }
    
    @keyframes idz-dots {
        0%, 100% { content: '...'; }
    }
}