/* Audit PDF Merger Styles */
.audit-pdf-merger-error {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
}

#audit-pdf-merger-container {
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

.audit-pdf-merger-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.audit-pdf-merger-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    font-weight: 600;
}

.audit-pdf-merger-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
}

.audit-pdf-merger-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .audit-pdf-merger-list {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .audit-pdf-merger-list {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 1.5rem;
    }
}

.audit-pdf-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #fff;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.audit-pdf-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.audit-pdf-item-info {
    text-align: center;
    width: 100%;
}

.audit-pdf-item-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 0.25rem;
    word-wrap: break-word;
}

.audit-pdf-exclude-badge {
    display: inline-block;
    background: #ff6b6b;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.audit-pdf-item-filename {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.audit-pdf-item-upload {
    width: 100%;
    position: relative;
    min-height: 70px;
}

.audit-pdf-dropzone {
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    padding: 0.5rem;
    padding-top: 0.25rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #fafafa;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.audit-pdf-dropzone:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.audit-pdf-dropzone.dragover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: scale(1.02);
}

.audit-pdf-dropzone.has-files {
    padding: 0.75rem;
    text-align: left;
}

/* Cross-dropzone drag feedback */
.audit-pdf-dropzone.drag-active {
    border-color: #4caf50;
    background: #f1f8e9;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.audit-pdf-dropzone.drag-over {
    border-color: #ff9800;
    background: #fff3e0;
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(255, 152, 0, 0.3);
}

.audit-pdf-dropzone.drag-active.has-files {
    border-style: solid;
}

/* Improved drag detection for files container */
.audit-pdf-dropzone.drag-over .audit-pdf-files-container {
    background: rgba(255, 152, 0, 0.1);
    border: 2px dashed #ff9800;
    border-radius: 4px;
}

/* Enhanced feedback for empty containers during drag */
.audit-pdf-dropzone.drag-over:not(.has-files) .audit-pdf-files-container {
    background: rgba(255, 152, 0, 0.15);
}

/* Enhanced empty container feedback */
.audit-pdf-dropzone.drag-over .audit-pdf-files-container:empty {
    background: rgba(255, 152, 0, 0.15);
    position: relative;
}

.audit-pdf-dropzone.drag-over .audit-pdf-files-container:empty::after {
    content: "Drop files here";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff9800;
    font-weight: 500;
    font-size: 0.9rem;
    pointer-events: none;
}

.audit-pdf-dropzone-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    pointer-events: none;
}

.audit-pdf-upload-icon {
    width: 32px;
    height: 32px;
    color: #999;
    margin-bottom: 0.5rem;
}

.audit-pdf-dropzone-placeholder p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

.audit-pdf-file-input {
    display: none !important; /* Hide the input completely and use click handler */
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    z-index: -1 !important;
    pointer-events: none !important;
}

/* Multiple Files Container */
.audit-pdf-files-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1; /* Take up available space */
    position: relative;
}

/* When dropzone doesn't have files, make container take up more space */
.audit-pdf-dropzone:not(.has-files) .audit-pdf-files-container {
    flex-grow: 1; /* Expand to fill available space */
}

/* Make empty files container a better drop target */
.audit-pdf-files-container:empty::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: inherit; /* Use the container's min-height */
    pointer-events: none;
}

.audit-pdf-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f0f8ff;
    border: 2px solid #667eea;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
    z-index: 5;
}

.audit-pdf-file-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.audit-pdf-file-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(2deg);
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.audit-pdf-file-item.drag-over {
    border-color: #ff6b6b;
    background: #fff5f5;
}

/* SortableJS Classes */
.audit-pdf-file-item-ghost {
    opacity: 0.3;
    background: #e3f2fd !important;
    border: 2px dashed #2196f3 !important;
}

.audit-pdf-file-item-chosen {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transform: scale(1.02);
}

.audit-pdf-file-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.audit-pdf-file-icon {
    width: 20px;
    height: 20px;
    color: #667eea;
    flex-shrink: 0;
}

.audit-pdf-filename {
    font-size: 0.85rem;
    font-weight: 500;
    color: #333;
    word-break: break-all;
    flex: 1;
}

.audit-pdf-drag-handle {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: 0.5rem;
    opacity: 0.5;
    cursor: grab;
    padding: 2px;
    transition: opacity 0.2s ease;
}

.audit-pdf-drag-handle:hover {
    opacity: 0.8;
}

.audit-pdf-file-item.dragging .audit-pdf-drag-handle {
    opacity: 1;
}

.audit-pdf-drag-handle::before,
.audit-pdf-drag-handle::after {
    content: '';
    width: 3px;
    height: 3px;
    background: #999;
    border-radius: 50%;
}

.audit-pdf-remove-btn {
    background: #ff6b6b;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
    padding: 0;
    outline: none;
}

.audit-pdf-remove-btn:hover {
    background: #ff5252;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

.audit-pdf-remove-btn:focus {
    outline: 2px solid #ff5252;
    outline-offset: 2px;
}

.audit-pdf-remove-btn:active {
    transform: scale(0.95);
}

.audit-pdf-remove-icon {
    width: 14px;
    height: 14px;
    color: white;
    stroke-width: 2.5;
}

/* Drop Indicator */
.audit-pdf-drop-indicator {
    height: 2px;
    background: #667eea;
    border-radius: 1px;
    margin: 2px 0;
    opacity: 0;
    transition: opacity 0.2s ease;
    position: relative;
}

.audit-pdf-drop-indicator.active {
    opacity: 1;
    animation: pulse 1s infinite;
}

.audit-pdf-drop-indicator::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -2px;
    width: 6px;
    height: 6px;
    background: #667eea;
    border-radius: 50%;
}

.audit-pdf-drop-indicator::after {
    content: '';
    position: absolute;
    right: -4px;
    top: -2px;
    width: 6px;
    height: 6px;
    background: #667eea;
    border-radius: 50%;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Add Files Button - Always Visible */
.audit-pdf-add-files-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.45rem;
    background: #313131;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.audit-pdf-add-files-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.audit-pdf-add-files-icon {
    width: 16px;
    height: 16px;
}

.audit-pdf-dropzone.has-files .audit-pdf-add-files-btn {
    margin-top: 0.25rem;
}

.audit-pdf-merger-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.audit-pdf-name-input {
    width: 100%;
}

#audit-pdf-report-name {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

#audit-pdf-report-name:focus {
    outline: none;
    border-color: #667eea;
}

.audit-pdf-create-button {
    width: 100%;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.audit-pdf-create-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.audit-pdf-create-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.audit-pdf-btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Modern Spinner Styles */
.audit-pdf-spinner {
    width: 20px;
    height: 20px;
    animation: audit-spinner-rotate 1s linear infinite;
}

.audit-pdf-spinner .path {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    animation: audit-spinner-dash 1.5s ease-in-out infinite;
}

.audit-pdf-large-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem auto;
    animation: audit-spinner-rotate 1s linear infinite;
}

.audit-pdf-large-spinner .path {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    animation: audit-spinner-dash 1.5s ease-in-out infinite;
}

@keyframes audit-spinner-rotate {
    100% { 
        transform: rotate(360deg); 
    }
}

@keyframes audit-spinner-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Simple Animated Checkmark Styles */
.audit-pdf-checkmark {
    width: 120px;
    height: 120px;
    display: block;
    margin: 0 auto 1rem auto;
    animation: audit-checkmark-bounce 0.6s ease-in-out 0.3s both;
}

.audit-pdf-checkmark-path {
    stroke-dasharray: 33;
    stroke-dashoffset: 33;
    animation: audit-checkmark-draw 0.5s ease-out forwards;
}

/* Small checkmark for button */
.audit-pdf-checkmark-small {
    width: 40px;
    height: 40px;
    display: block;
    animation: audit-checkmark-bounce-small 0.6s ease-in-out 0.3s both;
}

.audit-pdf-checkmark-small .audit-pdf-checkmark-path {
    stroke-dasharray: 33;
    stroke-dashoffset: 33;
    animation: audit-checkmark-draw 0.5s ease-out forwards;
}

/* Checkmark Animations */
@keyframes audit-checkmark-draw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes audit-checkmark-bounce {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes audit-checkmark-bounce-small {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    70% {
        transform: scale(0.85);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modal Styles */
.audit-pdf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.audit-pdf-modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.audit-pdf-modal-header h4 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.25rem;
}

.audit-pdf-modal-body {
    margin-bottom: 1.5rem;
    color: #666;
    line-height: 1.6;
}

.audit-pdf-modal-body ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
    color: #c33;
}

/* Specific paragraph margin overrides for modal */
.audit-pdf-continue-question {
    margin: 0 !important;
}

.audit-pdf-print-note {
    margin: 0 !important;
}

.audit-pdf-modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.audit-pdf-btn-primary, .audit-pdf-btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audit-pdf-btn-primary {
    background: #667eea;
    color: white;
}

.audit-pdf-btn-primary:hover {
    background: #5a6fd8;
}

.audit-pdf-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.audit-pdf-btn-secondary:hover {
    background: #e0e0e0;
}

/* Loading Overlay */
.audit-pdf-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(8px);
}

.audit-pdf-loading-content {
    text-align: center;
    padding: 2rem;
}

.audit-pdf-loading-content h3 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.5rem;
}

.audit-pdf-loading-content p {
    margin: 0;
    color: #666;
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .audit-pdf-item {
        padding: 1rem; /* Keep the same padding since we're already stacked */
    }
    
    .audit-pdf-item-upload {
        width: 100%; /* Already full width, just maintaining consistency */
    }
    
    .audit-pdf-modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .audit-pdf-modal-actions {
        flex-direction: column;
    }
    
    .audit-pdf-btn-primary, .audit-pdf-btn-secondary {
        width: 100%;
    }
}

@media (max-width: 480px) {
    #audit-pdf-merger-container {
        padding: 0 1rem;
    }
    
    .audit-pdf-merger-header {
        padding: 1rem;
    }
    
    .audit-pdf-merger-header h3 {
        font-size: 1.5rem;
    }
    
    .audit-pdf-item {
        padding: 1rem;
    }
    
    .audit-pdf-dropzone {
        padding: 1rem;
    }
    
    .audit-pdf-item-upload {
        min-height: 70px; /* Slightly reduced for mobile */
    }
}

/* Hide placeholder elements only for the specific dropzone being hovered over during drag */
.audit-pdf-dropzone.drag-over .audit-pdf-dropzone-placeholder {
    display: none;
}

/* Completion Screen Styles */
.audit-pdf-completion-screen {
    position: relative;
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.audit-pdf-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.audit-pdf-close-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.audit-pdf-close-btn svg {
    width: 20px;
    height: 20px;
    color: #666;
}

.audit-pdf-close-btn:hover svg {
    color: #333;
}

.audit-pdf-success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    position: relative;
}

.audit-pdf-success-icon svg {
    width: 100%;
    height: 100%;
}

.audit-pdf-success-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-linecap: round;
    animation: audit-success-circle 0.8s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.audit-pdf-success-check {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke-linecap: round;
    animation: audit-success-check 0.8s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes audit-success-circle {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes audit-success-check {
    to {
        stroke-dashoffset: 0;
    }
}

.audit-pdf-completion-screen h3 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.75rem;
    font-weight: 600;
}

.audit-pdf-completion-screen p {
    margin: 0 0 2rem 0;
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
}

.audit-pdf-download-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.audit-pdf-download-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.audit-pdf-download-item:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.audit-pdf-download-info {
    flex: 1;
    text-align: left;
    margin-right: 1rem;
}

.audit-pdf-download-info strong {
    display: block;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 0.25rem;
}

.audit-pdf-download-info span {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.audit-pdf-download-info small {
    display: block;
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
}

.audit-pdf-download-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 120px;
    justify-content: center;
}

.audit-pdf-download-btn:hover:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.audit-pdf-download-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.audit-pdf-download-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.audit-pdf-download-btn.downloaded {
    background: #4caf50;
    color: white;
}

.audit-pdf-download-btn.downloaded:hover {
    background: #45a049;
}

.audit-pdf-btn-spinner {
    width: 20px;
    height: 20px;
    animation: audit-spinner-rotate 1s linear infinite;
}

.audit-pdf-btn-spinner .path {
    stroke: currentColor;
    stroke-linecap: round;
    animation: audit-spinner-dash 1.5s ease-in-out infinite;
}

.audit-pdf-success-check-small {
    width: 20px;
    height: 20px;
    color: #4caf50;
}

/* Responsive Design for Completion Screen */
@media (max-width: 768px) {
    .audit-pdf-completion-screen {
        padding: 1.5rem;
    }
    
    .audit-pdf-completion-screen h3 {
        font-size: 1.5rem;
    }
    
    .audit-pdf-download-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .audit-pdf-download-info {
        margin-right: 0;
        text-align: center;
    }
    
    .audit-pdf-download-btn {
        width: 100%;
        margin: 0;
    }
}

@media (max-width: 480px) {
    .audit-pdf-completion-screen {
        padding: 1rem;
    }
    
    .audit-pdf-close-btn {
        top: 0.5rem;
        right: 0.5rem;
        width: 36px;
        height: 36px;
    }
    
    .audit-pdf-success-icon {
        width: 60px;
        height: 60px;
    }
    
    .audit-pdf-download-item {
        padding: 1rem;
    }
    
    .audit-pdf-download-info strong {
        font-size: 1rem;
    }
} 