/**
 * TurnUpCity Document Viewer Styles
 * Modal and viewer container styles
 * Version 3.0.0
 */

/* Modal Overlay */
.turnup-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.turnup-viewer-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.modal-container {
    position: relative;
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    margin: 5vh auto;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.turnup-viewer-modal.active .modal-container {
    transform: scale(1);
}

.modal-header {
    background: #222;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #333;
}

.modal-header h2 {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-close {
    background: transparent;
    border: none;
    color: #999;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 16px;
}

.modal-close:hover {
    background: #333;
    color: #fff;
}

.modal-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #1a1a1a;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Loading Indicator */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.loading-indicator .spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #5B4D96;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-indicator p {
    color: #999;
    font-size: 14px;
}

/* Document Card Viewer Buttons */
.document-card .viewer-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.turnup-view-flipbook,
.turnup-view-pdf,
.turnup-view-document {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.turnup-view-flipbook {
    background: linear-gradient(135deg, #5B4D96 0%, #4f46e5 100%);
    color: #fff;
}

.turnup-view-flipbook:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #5B4D96 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 77, 150, 0.3);
}

.turnup-view-pdf {
    background: #555;
    color: #fff;
}

.turnup-view-pdf:hover {
    background: #666;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.turnup-view-document {
    background: #5B4D96;
    color: #fff;
}

.turnup-view-document:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 77, 150, 0.3);
}

.viewer-buttons .icon {
    font-size: 16px;
}

/* Document Protection Form */
.turnup-document-protection-form {
    max-width: 400px;
    margin: 40px auto;
    padding: 32px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.protection-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.turnup-document-protection-form h3 {
    color: #333;
    font-size: 20px;
    margin-bottom: 12px;
}

.protection-message {
    color: #666;
    font-size: 14px;
    margin-bottom: 24px;
}

.form-field {
    margin-bottom: 16px;
}

.form-field input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-field input[type="password"]:focus {
    outline: none;
    border-color: #5B4D96;
}

.form-actions {
    margin-top: 20px;
}

.btn-primary {
    background: #5B4D96;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 77, 150, 0.3);
}

.document-access-denied {
    text-align: center;
}

.document-access-denied p {
    margin-bottom: 16px;
}

/* Body when modal is open */
body.modal-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-container {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-header h2 {
        font-size: 16px;
    }
    
    .modal-close {
        font-size: 28px;
        width: 36px;
        height: 36px;
    }
    
    .viewer-buttons {
        flex-direction: column;
    }
    
    .turnup-view-flipbook,
    .turnup-view-pdf,
    .turnup-view-document {
        width: 100%;
        justify-content: center;
    }
    
    .turnup-document-protection-form {
        margin: 20px;
        padding: 24px;
    }
}

/* Gutenberg Block Styles */
.wp-block-turnupcity-document-viewer {
    margin: 32px 0;
}

.wp-block-turnupcity-document-viewer.alignleft {
    float: left;
    margin-right: 32px;
    max-width: 50%;
}

.wp-block-turnupcity-document-viewer.alignright {
    float: right;
    margin-left: 32px;
    max-width: 50%;
}

.wp-block-turnupcity-document-viewer.aligncenter {
    margin-left: auto;
    margin-right: auto;
}

.wp-block-turnupcity-document-viewer.alignwide {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.wp-block-turnupcity-document-viewer.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
}

/* Placeholder for block editor */
.turnup-document-placeholder {
    background: #f5f5f5;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    color: #666;
    font-size: 14px;
}
