/**
 * Midas PDF Generator - Frontend Styles
 */

/* PDF Generation Buttons */
.midas-pdf-generate-btn,
.midas-pdf-generate-record-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
    transition: background-color 0.2s;
}

.midas-pdf-generate-btn:hover,
.midas-pdf-generate-record-btn:hover {
    background: #c82333;
    color: white;
    text-decoration: none;
}

.midas-pdf-generate-btn:disabled,
.midas-pdf-generate-record-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* PDF Download Links */
.midas-pdf-download-link {
    display: inline-flex;
    align-items: center;
    color: #dc3545;
    text-decoration: none;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.midas-pdf-download-link:hover {
    color: #c82333;
    background: rgba(220, 53, 69, 0.1);
    text-decoration: none;
}

.midas-pdf-download-link::before {
    content: '📄';
    margin-right: 5px;
}

/* PDF Status Messages */
.midas-pdf-status {
    padding: 10px 15px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

.midas-pdf-status.generating {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.midas-pdf-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.midas-pdf-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* PDF Modal */
.midas-pdf-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.midas-pdf-modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90%;
    width: 500px;
    overflow: hidden;
}

.midas-pdf-modal-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.midas-pdf-modal-header h3 {
    margin: 0;
    color: #495057;
}

.midas-pdf-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.midas-pdf-modal-close:hover {
    background: #f8f9fa;
    color: #495057;
}

.midas-pdf-modal-body {
    padding: 20px;
}

/* PDF Preview */
.midas-pdf-preview {
    width: 100%;
    height: 600px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

/* Loading Animation */
.midas-pdf-loading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.midas-pdf-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #dc3545;
    border-radius: 50%;
    animation: midas-pdf-spin 1s linear infinite;
}

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

/* Form Integration */
.filemaker-form .midas-pdf-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.filemaker-form .midas-pdf-actions h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 16px;
}

/* Data Table Integration */
.filemaker-data-table .midas-pdf-column {
    text-align: center;
    width: 80px;
}

.filemaker-data-table .midas-pdf-generate-record-btn {
    padding: 4px 8px;
    font-size: 12px;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .midas-pdf-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .midas-pdf-generate-btn,
    .midas-pdf-generate-record-btn {
        width: 100%;
        margin: 5px 0;
    }
    
    .midas-pdf-modal-header {
        padding: 15px;
    }
    
    .midas-pdf-modal-body {
        padding: 15px;
    }
}

/* Print Styles */
@media print {
    .midas-pdf-generate-btn,
    .midas-pdf-generate-record-btn,
    .midas-pdf-actions {
        display: none !important;
    }
}