/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Error Alert Styles */
.error-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    max-width: 600px;
    width: 90%;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
}

.error-content {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
}

.error-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.error-message {
    flex: 1;
    color: #721c24;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-line;
}

.error-close {
    background: none;
    border: none;
    color: #721c24;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.error-close:hover {
    background-color: rgba(114, 28, 36, 0.1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: black;
    background-color: white;
    min-height: 100vh;
}

.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 20px;
}


/* VoIP Toolbox Header */
.voiptoolbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    padding-top: 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid #dee2e6;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.vt-logo {
    width: 32px;
    height: 32px;
}

.voiptoolbox-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.separator {
    color: #dee2e6;
    font-weight: 300;
    font-size: 1.2rem;
}

.sip-viewer-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #667eea;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    min-height: 40px;
}

/* Signup button styles */
.signup-btn {
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #6f42c1;
    color: white;
    border: 1px solid #6f42c1;
    box-sizing: border-box;
    padding: calc(.5rem - 1px) .75rem;
    line-height: 1.5;
    transition: all 0.2s ease-in-out;
    border-radius: 0.375rem;
    text-decoration: none;
    font-size: 0.875rem;
}

.signup-btn:hover {
    background-color: black;
    color: white;
    border-color: black;
    text-decoration: none;
}

.signup-btn .badge {
    font-size: 0.7em;
    background-color: #ff6b35;
    color: white;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-weight: 700;
}

.return-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.return-link:hover {
    color: #5a67d8;
}

/* Page Title */
.page-title {
    text-align: center;
    margin-bottom: 2rem;
}

.page-title h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    color: #333;
}

/* Main content */
main {
    background: white;
    overflow: hidden;
}

/* Upload section */
.upload-section {
    padding: 40px;
}



.upload-area {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    background: #fafafa;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: #667eea;
    margin-bottom: 20px;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

.upload-content p {
    color: #444;
    font-size: 1rem;
}

.upload-content p small {
    color: #777;
    font-size: 0.8rem;
}

/* File info */
.file-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9rem;
}

.file-info .filename {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.file-info .file-size {
    color: #666;
    font-size: 0.85rem;
    white-space: nowrap;
}

.file-info .btn-clear {
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

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

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

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-outline {
    background: transparent;
    color: #6c757d;
    border: 1px solid #6c757d;
}

.btn-outline:hover {
    background: #6c757d;
    color: white;
}

.btn-primary:disabled,
.btn-secondary:disabled {
    background: #6c757d !important;
    color: #adb5bd !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.btn-primary:disabled:hover,
.btn-secondary:disabled:hover {
    background: #6c757d !important;
    color: #adb5bd !important;
}

/* Multi-select button disabled state */
#generateMultiDiagram:disabled {
    background: #6c757d !important;
    color: #adb5bd !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

#generateMultiDiagram:disabled:hover {
    background: #6c757d !important;
    color: #adb5bd !important;
}

.btn-clear {
    border: 1px solid #dc3545;
    background: transparent;
    color: #dc3545;
    font-size: 1rem;
    font-weight: bold;
    line-height: 1;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-clear:hover {
    background: #c82333;
    color: white;
}

/* Loading section */
.loading-section {
    padding: 60px 40px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: #f3f3f3;
    border-radius: 4px;
    margin: 20px auto 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #667eea;
    width: 0%;
}

.multi-select-controls {
    margin-bottom: 20px;
}

.multi-select-controls .btn {
    margin-right: 10px;
}

.multi-select-controls .btn:last-child {
    margin-right: 0;
}

.calls-list h3 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: #333;
}

.calls-container {
    display: block;
}

.calls-table-header {
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 5px;
}

.call-row {
    display: grid;
    grid-template-columns: 40px 140px 1fr 1fr 80px 100px 80px 70px 120px;
    gap: 15px;
    align-items: center;
    padding: 10px 15px;
    font-size: 0.9rem;
}

.call-row.header-row {
    font-weight: 600;
    color: #666;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px 15px;
}

.call-item {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    background: white;
    margin-bottom: 2px;
    transition: all 0.2s ease;
}

.call-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    background: #fafbff;
}

.call-item.selected {
    border: 2px solid #007bff !important;
    background-color: rgba(0, 123, 255, 0.03) !important;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15) !important;
}

.call-item.selected:hover {
    border-color: #0056b3 !important;
    background-color: rgba(0, 123, 255, 0.05) !important;
}

.call-checkbox-col {
    display: flex;
    justify-content: center;
}

.call-checkbox-col input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    transform: scale(0.9);
}

.call-time-col {
    font-size: 0.85rem;
}

.call-from-col,
.call-to-col {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.call-method-col {
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: #007bff;
}

.call-status-col {
    text-align: center;
}

.call-duration-col,
.call-messages-col {
    text-align: center;
    font-size: 0.85rem;
}

.call-id-col {
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Diagram section */
.diagram-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.diagram-header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.diagram-header-left h3 {
    margin: 0;
    color: #333;
}

.diagram-header-left .btn {
    font-weight: 500;
    padding: 10px 20px;
}

.diagram-header h3 {
    font-size: 1.5rem;
}

.diagram-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.diagram-container {
    border-radius: 8px;
    min-height: 400px;
    overflow-x: auto;
    overflow-y: visible;
    /* Ensure proper scrolling behavior */
    position: relative;
    max-width: 100%;
}

/* Dual scrollbar container */
.diagram-scroll-wrapper {
    position: relative;
    width: 100%;
}

/* Top scrollbar container */
.diagram-top-scrollbar {
    overflow-x: auto;
    overflow-y: hidden;
    height: 20px;
    margin-bottom: 5px;
    /* Only show when content is scrollable */
    display: none;
}

.diagram-top-scrollbar::-webkit-scrollbar {
    height: 12px;
}

.diagram-top-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.diagram-top-scrollbar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
    border: 2px solid #f1f1f1;
}

.diagram-top-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Invisible content div to match the width of the main diagram */
.diagram-top-scrollbar-content {
    height: 1px;
    /* Width will be set by JavaScript to match diagram content */
    min-width: 100%;
}

/* Show top scrollbar when content is scrollable */
.diagram-container[data-scrollable="true"] + .diagram-top-scrollbar,
.diagram-scroll-wrapper[data-scrollable="true"] .diagram-top-scrollbar {
    display: block;
}

/* Custom scrollbar styles for webkit browsers */
.diagram-container::-webkit-scrollbar {
    height: 12px;
    width: 12px;
}

.diagram-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.diagram-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
    border: 2px solid #f1f1f1;
}

.diagram-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}



/* Ensure SIP sequence diagrams can scroll properly */
.sip-sequence-diagram {
    min-width: max-content;
    position: relative;
}

/* Make timestamp column sticky for better visibility */
.sip-sequence-diagram .timestamp-header,
.sip-sequence-diagram .timestamp-cell {
    position: sticky;
    left: 0;
    z-index: 50;
}

/* Ensure proper background for sticky elements */
.sip-sequence-diagram .timestamp-header {
    background: #e9ecef;
}

.sip-sequence-diagram .timestamp-cell {
    background: #fafafa;
}

/* Additional scrolling improvements */
.diagram-container {
    /* Enable smooth scrolling */
    scroll-behavior: smooth;
    /* Ensure scrollbars are always visible on supported browsers */
    -webkit-overflow-scrolling: touch;
}

/* Add visual indicator for scrollable content */
.diagram-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, transparent, #c1c1c1, transparent);
    pointer-events: none;
    z-index: 1;
}

/* Ensure the diagram content doesn't get cut off */
.sip-sequence-diagram .diagram-header,
.sip-sequence-diagram .messages-container {
    min-width: max-content;
}

/* Improve scrolling behavior for large diagrams - removed scroll snapping for natural scroll behavior */

/* Ensure timestamp column is always accessible - removed scroll snap alignment for natural scroll behavior */

/* Add visual feedback for scrollable content */
.diagram-container:hover {
    scrollbar-color: #a8a8a8 #e0e0e0;
}

/* Ensure proper z-index layering - messages should be above timestamp column */
.sip-sequence-diagram .diagram-header {
    z-index: 10;
}

.sip-sequence-diagram .messages-container {
    z-index: 15;
}

/* Ensure message content is visible above timestamp column */
.sip-sequence-diagram .message-arrow,
.sip-sequence-diagram .message-label {
    z-index: 20;
}

/* Additional fixes for message visibility */
.sip-sequence-diagram .message-row {
    position: relative;
    z-index: 15;
}

.sip-sequence-diagram .message-area {
    position: relative;
    z-index: 15;
}

/* Ensure messages starting from leftmost columns are visible */
.sip-sequence-diagram .message-arrow {
    position: absolute;
    z-index: 20;
}

/* Fix for messages that start very close to the timestamp column */
.sip-sequence-diagram .message-arrow[style*="left: 0px"],
.sip-sequence-diagram .message-arrow[style*="left: 1px"],
.sip-sequence-diagram .message-arrow[style*="left: 2px"] {
    z-index: 25;
}

/* Ensure message labels are always visible */
.sip-sequence-diagram .message-label {
    z-index: 30;
    position: absolute;
}

/* Fix stacking context issues with sticky timestamp column */
.sip-sequence-diagram .timestamp-header,
.sip-sequence-diagram .timestamp-cell {
    position: sticky;
    left: 0;
    z-index: 50;
    /* Ensure sticky elements don't create problematic stacking contexts */
    isolation: isolate;
}

/* Ensure messages container has proper stacking context */
.sip-sequence-diagram .messages-container {
    position: relative;
    z-index: 15;
    /* Create a new stacking context for messages */
    isolation: isolate;
}

/* Ensure individual message rows are properly layered */
.sip-sequence-diagram .message-row {
    position: relative;
    z-index: 15;
    /* Ensure each row creates its own stacking context */
    isolation: isolate;
}

/* Specific fix for messages that start very close to timestamp column */
.sip-sequence-diagram .message-arrow {
    position: absolute !important;
    z-index: 25 !important;
    /* Ensure arrows are always visible */
    pointer-events: auto;
}

/* Force visibility for messages that might be hidden */
.sip-sequence-diagram .message-arrow,
.sip-sequence-diagram .message-label {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Ensure the first participant column messages are visible */
.sip-sequence-diagram .message-arrow[style*="left: 0px"],
.sip-sequence-diagram .message-arrow[style*="left: 1px"],
.sip-sequence-diagram .message-arrow[style*="left: 2px"],
.sip-sequence-diagram .message-arrow[style*="left: 3px"],
.sip-sequence-diagram .message-arrow[style*="left: 4px"],
.sip-sequence-diagram .message-arrow[style*="left: 5px"] {
    z-index: 30 !important;
    position: absolute !important;
}

/* Ensure message area doesn't clip arrows */
.sip-sequence-diagram .message-area {
    overflow: visible !important;
    position: relative;
    z-index: 15;
}

/* Ensure message arrows extend beyond their containers if needed */
.sip-sequence-diagram .message-arrow {
    overflow: visible !important;
    clip-path: none !important;
}

/* Fix for arrows that might be positioned very close to left edge */
.sip-sequence-diagram .message-arrow[style*="left: 10px"],
.sip-sequence-diagram .message-arrow[style*="left: 11px"],
.sip-sequence-diagram .message-arrow[style*="left: 12px"],
.sip-sequence-diagram .message-arrow[style*="left: 13px"],
.sip-sequence-diagram .message-arrow[style*="left: 14px"],
.sip-sequence-diagram .message-arrow[style*="left: 15px"] {
    z-index: 30 !important;
    position: absolute !important;
    /* Ensure these arrows are fully visible */
    clip: auto !important;
    overflow: visible !important;
}

/* Ensure all containers allow proper overflow for message arrows */
.sip-sequence-diagram .messages-container {
    overflow: visible !important;
}

.sip-sequence-diagram .message-row {
    overflow: visible !important;
}

.sip-sequence-diagram .message-row:hover .timestamp-cell {
    background-color: #ececec;
}

/* Ensure the entire diagram allows proper overflow */
.sip-sequence-diagram {
    overflow: visible !important;
}

/* Force visibility for all message elements */
.sip-sequence-diagram .message-arrow,
.sip-sequence-diagram .message-label,
.sip-sequence-diagram .lifeline {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}



/* Ensure proper spacing for sticky elements */
.sip-sequence-diagram .timestamp-header,
.sip-sequence-diagram .timestamp-cell {
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

/* Add scroll indicator for wide diagrams */

.diagram-container:not([data-scrollable="false"]):hover::after {
    opacity: 1;
}

/* Hide scroll indicator when not needed */
.diagram-container[data-scrollable="false"]::after {
    display: none;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .voiptoolbox-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .header-left {
        justify-content: center;
    }
    
    .header-right {
        justify-content: center;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .signup-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    
    .file-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 12px;
    }
    
    .file-info .filename {
        max-width: none;
    }
    
    .call-row {
        grid-template-columns: 30px 110px 1fr 1fr 60px 80px 60px 50px 100px;
        gap: 8px;
        padding: 8px 10px;
        font-size: 0.8rem;
    }
    
    .call-row.header-row {
        padding: 10px;
    }
    
    .diagram-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .diagram-header-left {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

/* Share Modal specific styles */
.share-url-container {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    align-items: stretch;
}

.share-url-input {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
    background: #f8f9fa;
    color: #333;
}

.share-url-input:focus {
    outline: none;
    border-color: #667eea;
}

.share-info {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.share-info p {
    margin: 5px 0;
}

.share-info small {
    color: #666;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background: #667eea;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.message-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    margin-bottom: 8px;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    font-weight: 600;
    width: 120px;
    color: #666;
}

.info-value {
    flex: 1;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.message-headers,
.message-body {
    margin-bottom: 20px;
}

.message-headers h4,
.message-body h4 {
    margin-bottom: 10px;
    font-size: 1rem;
}

.message-headers pre,
.message-body pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Utility classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
} 
.btn-view-calls {
    margin-left: 10px;
}