/* Tour system customizations for Super Bridge */

/* Core tour styles extracted from tour-service.js */
.jqtour-tip {
    position: absolute;
    background: #111;
    color: #fff;
    padding: 0;
    border-radius: 12px 12px 0 0;
    font-size: 14px; /* Increased from 12px */
    line-height: 1.4; /* Increased from 1.3 for better readability */
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, .35);
    border-top: 1px solid rgba(255, 255, 255, .1);
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0 auto;
    width: 100%; /* Full width of container */
    max-width: var(--app-max-width); /* Constrain to app max width */
    
    /* FIXED HEIGHT: 30% of viewport height */
    height: 30vh;
    min-height: 150px; /* Ensure minimum usability on very small screens */
    max-height: 400px; /* Cap maximum height on very tall screens */
    
    /* Flexbox layout for proper sizing */
    display: flex;
    flex-direction: column;
    
    /* Smooth transition for collapse/expand */
    transition: height 0.3s ease;
}

/* Collapsed preview - shown only when collapsed */
.jqtour-collapsed-preview {
    display: none;
}

.jqtour-tip.jqtour-collapsed .jqtour-collapsed-preview {
    display: block;
    padding: 6px 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.jqtour-collapsed-title {
    font-weight: 500;
}

/* Collapsed state - header + step title + buttons visible, content hidden */
.jqtour-tip.jqtour-collapsed {
    height: auto !important;
    min-height: 0 !important;
}

.jqtour-tip.jqtour-collapsed .jqtour-tip-content {
    display: none;
}

/* Keep actions visible but compact when collapsed */
.jqtour-tip.jqtour-collapsed .jqtour-actions {
    padding: 6px 24px 6px 20px; /* Match content padding for alignment */
}

/* Header layout: title left, controls right */
.jqtour-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 4px 12px; /* MINIMAL top/bottom padding */
    min-height: 26px; /* MINIMAL height */
    flex-shrink: 0; /* Don't shrink header */
}

.jqtour-title {
    color: #28a745;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.9;
}

.jqtour-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto; /* Push actions to the far right */
}

.jqtour-spinner {
    color: #28a745;
    font-size: 12px;
    margin-right: 6px;
}

.jqtour-spinner i {
    animation: spin 1s linear infinite;
}

.jqtour-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.jqtour-collapse-icon {
    color: #28a745;
}

.jqtour-restart-icon {
    color: #28a745;
}

.jqtour-exit-icon {
    color: #fff;
}

.jqtour-tip-content {
    width: 100%; /* Full width of tour box */
    padding: 4px 24px 4px 20px; /* Increased right padding to prevent text cutoff */
    box-sizing: border-box; /* Include padding in width calculation */
    
    /* SCROLLABLE CONTENT */
    flex: 1 1 auto; /* Take up remaining space */
    overflow-y: auto; /* Allow scrolling */
    overflow-x: hidden;
    
    /* Smooth scrolling */
    scroll-behavior: smooth;
    
    /* Flex layout to push next instruction to bottom */
    display: flex;
    flex-direction: column;
    
    /* Prevent text overflow */
    word-wrap: break-word;
    overflow-wrap: break-word;
    
    /* Custom scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Webkit scrollbar styling */
.jqtour-tip-content::-webkit-scrollbar {
    width: 6px;
}

.jqtour-tip-content::-webkit-scrollbar-track {
    background: transparent;
}

.jqtour-tip-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.jqtour-tip-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.jqtour-actions {
    display: flex;
    align-items: center;
    gap: 8px; /* Increased for better spacing */
    padding: 8px 24px 8px 20px; /* Match content padding for alignment */
    justify-content: flex-end; /* Right-align buttons */
    width: 100%; /* Full width of tour box */
    flex-shrink: 0; /* Don't shrink button area - keeps fixed height */
    box-sizing: border-box; /* Include padding in width calculation */
    background: #111; /* Solid background to cover scrolling content */
    border-top: 1px solid rgba(255, 255, 255, 0.1); /* Subtle separator */
    z-index: 1; /* Ensure it stays above scrolling content */
}

/* Next instruction text in actions bar */
.jqtour-next-instruction {
    color: #4caf50; /* Bright green */
    font-style: italic;
    font-size: 13px; /* Slightly smaller than body text */
    flex: 0 1 auto; /* Allow to shrink if needed */
    margin-right: 4px; /* Small space before progress */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jqtour-progress {
    opacity: 0.7;
    font-size: 10px; /* Slightly smaller */
    color: #b0b0b0 !important;
    font-weight: 500 !important;
    white-space: nowrap; /* Prevent wrapping */
    flex-shrink: 0; /* Don't shrink progress text */
    margin-right: auto; /* Push buttons to right */
}

.jqtour-btn {
    background: #fff;
    color: #111;
    border: 0;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 12px;
}

.jqtour-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}



.jqtour-small-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 400;
}

.jqtour-exit-btn {
    background: #dc3545;
    color: #fff;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
}

.jqtour-exit-btn:hover {
    background: #c82333;
}

.jqtour-restart-btn {
    background: #6c757d;
    color: #fff;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
}

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

.jqtour-next-btn {
    background: #28a745;
    color: #000;
    font-weight: 600;
    padding: 3px 24px; /* SHORTER height (3px vertical), WIDER (24px horizontal) */
    font-size: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
    min-width: 80px; /* Wider minimum width */
}

.jqtour-next-btn:hover {
    background: #218838;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.4);
    transform: translateY(-1px);
    border: 1px solid #1e7e34;
}

.jqtour-done-btn {
    background: #28a745;
    color: #fff;
    font-weight: 600;
    padding: 3px 24px; /* SHORTER height (3px vertical), WIDER (24px horizontal) */
    font-size: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
    min-width: 80px; /* Wider minimum width */
}

.jqtour-done-btn:hover {
    background: #218838;
    color: #fff;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.4);
    transform: translateY(-1px);
    border: 1px solid #1e7e34;
}

/* Super Bridge theme enhancements */
.jqtour-tip {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* backdrop-filter removed - doesn't work consistently on iPhone */
}

.jqtour-tip h4 {
    margin: 0 0 6px 0;
    color: #ffffff;
    font-size: 15px; /* Increased from 13px */
    font-weight: 600;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.jqtour-tip p {
    margin: 0 0 6px 0;
    line-height: 1.4;
    color: #e0e0e0;
    font-size: 14px; /* Increased from 12px to match base */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.jqtour-tip p:last-child {
    margin-bottom: 0;
}

.jqtour-btn {
    font-family: inherit !important;
    font-size: 13px !important; /* Increased from 12px */
    font-weight: 500 !important;
    padding: 6px 12px !important; /* Slightly wider */
    border-radius: 5px !important;
    transition: all 0.05s ease !important;
    cursor: pointer !important;
    border: none !important;
}

.jqtour-btn:hover {
    transform: translateY(-1px);

}

.jqtour-btn:active {
    transform: translateY(0);
}

.jqtour-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.jqtour-btn-disabled {
    opacity: 0.4 !important;
    background-color: #6c757d !important;
    color: #ffffff !important;
    cursor: not-allowed !important;
}

/* Decision button styles */
.jqtour-decision-btn {
    display: none;
    padding: 8px 16px;
    margin: 0 4px;
    font-size: 12px;
}

.jqtour-yes-btn {
    background: #28a745;
    color: #fff;
}

.jqtour-no-btn {
    background: #dc3545;
    color: #fff;
}

.jqtour-decision-question {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

.jqtour-progress {
    opacity: 0.7;
    margin-right: auto;
    font-size: 11px;
    color: #b0b0b0 !important;
    font-weight: 500 !important;
}

/* Make sure tour overlays work well with Super Bridge's existing overlays */
.jqtour-wrap {
    z-index: 2147483000 !important;
}

/* Ensure tour elements don't interfere with existing modals */
/* Only apply to modal backdrops NOT inside #superModal (which has its own backdrop with proper z-index from modal.css) */
.modal-backdrop:not(#superModal .modal-backdrop) {
    z-index: 1050;
}

/* Tour tip responsive sizing - linear scaling */
.jqtour-tip {
    width: clamp(280px, 90vw, 100vw) !important;
    max-width: var(--app-max-width) !important;
    margin: 0 auto !important;
    left: 0 !important;
    right: 0 !important;
}

.jqtour-actions {
    flex-wrap: wrap;
    gap: clamp(4px, 1vw, 6px) !important;
}

.jqtour-btn {
    padding: 15px 24px !important;
    font-size: clamp(11px, 2.5vw, 12px) !important;
    min-width: clamp(70px, 18vw, 80px) !important;
}

/* Fix button colors - green when ready, gray when disabled */
.jqtour-next-btn {
    background: #28a745 !important; /* GREEN when ready */
    color: #000 !important;
}

.jqtour-next-btn:disabled {
    background: #6c757d !important; /* GRAY when disabled */
    color: #fff !important;
    opacity: 0.65 !important;
}

.jqtour-done-btn {
    background: #28a745 !important; /* GREEN */
    color: #fff !important;
}

.jqtour-done-btn:disabled {
    background: #6c757d !important; /* GRAY when disabled */
    opacity: 0.65 !important;
}

/* Ensure tour highlights work with Super Bridge's layout */
.jqtour-hole {
    transition: none !important;
}

/* Style for tour highlights that may target specific Super Bridge elements */
.admin-menu-wrapper.tour-highlight,
.calendar-header.tour-highlight,
.event-header.tour-highlight {
    position: relative;
    z-index: 2147483001;
}

/* Tour-specific class for centering content */
.jqtour-tip.center-placement {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* Development warning styles */
.jqtour-dev-warning {
    background: #ffebee !important;
    border: 1px solid #f44336 !important;
    padding: 10px !important;
    margin-bottom: 10px !important;
    border-radius: 4px !important;
    color: #c62828 !important;
}

.jqtour-dev-warning code {
    background: #ffcdd2 !important;
    padding: 2px 4px !important;
    border-radius: 2px !important;
}

/* Base layout classes */
.jqtour-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: var(--app-max-width);
    bottom: 0;
    display: none;
}

.jqtour-dim {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.jqtour-hole {
    position: absolute;
    pointer-events: none;
    /* iOS Safari optimizations */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform, left, top, width, height;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.jqtour-hole.hidden {
    display: none;
}

.jqtour-hole.visible {
    display: block;
}

.jqtour-actions-spacer {
    display: none; /* Hide spacer - using margin-right: auto on progress instead */
}

/* Decision step styles */
.tour-decision {
    text-align: center;
}

.tour-decision-question {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.5;
}

.tour-decision-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.tour-decision-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.05s ease;
    min-width: 80px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tour-decision-yes {
    background: #4CAF50;
    color: white;
}

.tour-decision-yes:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.tour-decision-no {
    background: #f44336;
    color: white;
}

.tour-decision-no:hover {
    background: #da190b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.tour-decision-btn:active {
    transform: translateY(0);
}

/* Responsive decision buttons - linear scaling */
.tour-decision-buttons {
    flex-direction: column;
    gap: clamp(8px, 2vw, 10px);
}

.tour-decision-btn {
    width: 100%;
    max-width: clamp(160px, 40vw, 200px);
}

/* Icon button styles moved to top of file with other header styles */

.jqtour-exit-icon:focus {
    color: var(--primary-color);
}
/* Tour Selector Styles */
.tour-selector {
    max-width: 100%;
}

.tour-selector .form-group {
    margin-bottom: 15px;
}

.tour-selector label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.tour-selector select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

.tour-selector select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.tour-description {
    font-style: italic;
    line-height: 1.4;
}

.tour-description p {
    margin: 0;
}

/* Tour next instruction styling */
/* Legacy styles - next instruction now in actions bar */
.tour-next-instruction {
    /* Kept for backward compatibility but not displayed */
    display: none;
}

/* Wrapper for next instruction - no longer used */
.tour-next-instruction-wrapper {
    display: none;
}

/* Main content area - let it take available space */
.tour-main-content {
    flex: 1 1 auto; /* Allow to grow and take available space */
    min-height: 0; /* Allow shrinking below content size if needed */
}

/* Small green next button for inline use in text */
.tour-next-button-small {
    display: inline-block;
    background-color: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: default;
    line-height: 1.2;
    white-space: nowrap;
}

/* Debug styling for development mode */
.tour-debug-panel {
    background: #e3f2fd;
    border: 2px solid #2196f3;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.tour-debug-panel h4 {
    color: #1976d2;
    margin-top: 0;
    margin-bottom: 10px;
}

.tour-debug-commands {
    background: #fff;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    border: 1px solid #ddd;
}

.tour-debug-commands code {
    background: #f5f5f5;
    padding: 1px 4px;
    border-radius: 2px;
    color: #d32f2f;
}

.tour-debug-state {
    background: #f5f5f5;
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    border: 1px solid #ddd;
}

/* Keyframes for spinner animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}