/* LinkWhisper Tours CSS */

/* Persistent Tour Widget */
.linkwhisper-tour-widget {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    border: 1px solid #e1e4e7;
    transition: all 0.3s ease;
}

/* Detect and avoid Tawk.to widget overlap */
body:has([id*="tawk"]) .linkwhisper-tour-widget,
body:has([class*="tawk"]) .linkwhisper-tour-widget {
    bottom: 120px;
}

.linkwhisper-tour-widget.minimized {
    width: auto;
    min-width: 280px;
    border-radius: 50px;
}

.linkwhisper-tour-widget:not(.minimized) {
    width: 320px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Minimized State */
.tour-widget-minimized {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 50px;
}

.tour-widget-minimized:hover {
    background-color: #f8f9fa;
}

.tour-widget-icon {
    font-size: 18px;
    margin-right: 10px;
}

.tour-widget-title {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
    color: #1e1e1e;
    margin-right: 10px;
}

.tour-widget-progress {
    background: rgb(120, 102, 255);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 10px;
}

.tour-widget-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #666;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: 5px;
}

.tour-widget-close:hover {
    color: #000;
    background-color: #f0f0f0;
}

/* Expanded State */
.tour-widget-expanded {
    padding: 0;
}

/* Expanded State Content */
.tour-header {
    padding: 16px 20px 0 20px;
}

.tour-title-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.tour-title-section h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e1e1e;
    line-height: 1.3;
    flex: 1;
}

.tour-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tour-progress-text {
    background: rgb(120, 102, 255);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.tour-dismiss, .tour-minimize, .tour-reset {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.tour-dismiss:hover, .tour-minimize:hover, .tour-reset:hover {
    color: #000;
    background-color: #f0f0f0;
}

.tour-dismiss:hover {
    color: #dc3232;
    background-color: #fee;
}

.tour-dismiss:focus, .tour-minimize:focus, .tour-reset:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Progress Bar */
.tour-progress-bar {
    background: #f0f0f0;
    height: 4px;
    border-radius: 2px;
    margin: 0 20px 10px 20px;
    overflow: hidden;
}

.tour-progress-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 20px 15px 20px;
}

.progress-fill {
    background: rgb(120, 102, 255);
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Checklist */
.tour-checklist {
    margin-bottom: 20px;
    padding: 0 20px;
    max-height: 200px;
    overflow-y: auto;
}

.step-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.step-item:hover {
    background: #f8f9fa;
    margin: 0 -10px;
    padding: 8px 10px;
}

.step-item.completed {
    opacity: 0.7;
}

.step-item.completed .step-title {
    text-decoration: line-through;
}

.step-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid rgb(120, 102, 255);
    border-radius: 50%;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: rgb(120, 102, 255);
    background: transparent;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.step-item.completed .step-checkbox {
    color: rgb(120, 102, 255);
    background: transparent;
}

.step-title {
    font-size: 14px;
    color: #1e1e1e;
    line-height: 1.4;
}

/* Action Buttons */
.tour-actions {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px 20px;
}

.btn-primary, .btn-secondary {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: rgb(120, 102, 255);
    color: white;
}

.btn-primary:hover {
    background: rgb(95, 77, 230);
}

.btn-primary:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.btn-secondary:focus {
    outline: 2px solid #666;
    outline-offset: 2px;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary:disabled:hover {
    background: #f0f0f0;
    border-color: #ddd;
}

/* Tooltip */
.linkwhisper-tour-tooltip {
    position: absolute;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    max-width: 320px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    border: 1px solid #e1e4e7;
}

.tooltip-content {
    padding: 20px;
}

.tooltip-content h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e1e1e;
    line-height: 1.3;
}

.tooltip-content p {
    margin: 0 0 15px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #666;
}

.tooltip-image {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 15px;
    border: 1px solid #e1e4e7;
    margin-top: 0;
}

/* Video Container - maintains 16:9 aspect ratio */
.tooltip-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio (9/16 * 100) */
    margin-bottom: 15px;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
    cursor: pointer;
}

.tooltip-video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.tooltip-video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.9;
    z-index: 1;
}

.tooltip-video-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
}

.tooltip-video-play-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.tooltip-video-play-btn svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.tooltip-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
}

/* Responsive adjustments for video */
@media (max-width: 768px) {
    .tooltip-video-container {
        padding-bottom: 56.25%; /* Keep 16:9 on tablets */
    }
}

@media (max-width: 480px) {
    .tooltip-video-container {
        padding-bottom: 56.25%; /* Keep 16:9 on mobile */
    }

    .tooltip-video-play-btn svg {
        width: 48px;
        height: 34px;
    }
}

/* Tooltip Progress */
.tooltip-progress {
    text-align: center;
    margin: 12px 0;
    padding: 8px 0;
    border-top: 1px solid #e0e0e0;
}

.step-counter {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.tooltip-actions {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.tooltip-actions .btn-secondary {
    background: #f6f7f7;
    color: rgb(120, 102, 255);
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tooltip-actions .btn-secondary:hover {
    background: #eeeeee;
    border-color: rgb(120, 102, 255);
}

.tooltip-actions .btn-primary {
    margin-left: auto;
}

/* Tooltip Arrow */
.tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.linkwhisper-tour-tooltip[data-position="bottom"] .tooltip-arrow {
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 10px 10px 10px;
    border-color: transparent transparent white transparent;
    filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.1));
}

.linkwhisper-tour-tooltip[data-position="top"] .tooltip-arrow {
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0 10px;
    border-color: white transparent transparent transparent;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.linkwhisper-tour-tooltip[data-position="right"] .tooltip-arrow {
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 10px 10px 0;
    border-color: transparent white transparent transparent;
    filter: drop-shadow(-2px 0 2px rgba(0, 0, 0, 0.1));
}

.linkwhisper-tour-tooltip[data-position="left"] .tooltip-arrow {
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent white;
    filter: drop-shadow(2px 0 2px rgba(0, 0, 0, 0.1));
}

/* Highlight Effects */
.linkwhisper-tour-highlight {
    position: relative;
    z-index: 9998;
}

.linkwhisper-tour-spotlight {
    border-color: #2271b1 !important;
    animation: linkwhisper-tour-pulse 2s infinite;
}

@keyframes linkwhisper-tour-pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
        border-width: 2px;
    }
    50% { 
        transform: scale(1.02);
        opacity: 0.9;
        border-width: 3px;
    }
}

/* Completion Message */
.linkwhisper-tour-completion {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    z-index: 10002;
    text-align: center;
    animation: linkwhisper-tour-completion 0.5s ease;
    border: 1px solid #e1e4e7;
}

.completion-content {
    padding: 40px;
}

.completion-icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: linkwhisper-tour-celebration 0.6s ease;
}

.completion-content h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
    color: #1e1e1e;
}

.completion-content p {
    margin: 0;
    font-size: 16px;
    color: #666;
    line-height: 1.4;
}

@keyframes linkwhisper-tour-completion {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes linkwhisper-tour-celebration {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1) rotate(5deg);
    }
    75% {
        transform: scale(1.1) rotate(-5deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .linkwhisper-tour-widget {
        left: 10px;
        right: 10px;
        bottom: 10px;
        width: auto;
        max-width: none;
    }

    .linkwhisper-tour-widget.minimized {
        min-width: auto;
    }

    .linkwhisper-tour-widget:not(.minimized) {
        width: auto;
        max-height: 70vh;
    }

    .tour-widget-minimized {
        padding: 10px 12px;
    }

    .tour-widget-title {
        font-size: 13px;
    }

    .tour-widget-progress {
        font-size: 11px;
        padding: 3px 6px;
    }

    .linkwhisper-tour-tooltip {
        max-width: calc(100vw - 40px);
        left: 20px !important;
        right: 20px;
        width: auto;
    }

    .tooltip-actions {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .completion-content {
        padding: 30px;
    }

    .completion-content h3 {
        font-size: 20px;
    }

    .completion-content p {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .tour-progress {
        padding: 15px;
    }

    .tour-header h3 {
        font-size: 14px;
    }

    .step-title {
        font-size: 13px;
    }

    .btn-primary, .btn-secondary {
        padding: 10px 16px;
        font-size: 13px;
    }

    .tooltip-content {
        padding: 15px;
    }

    .tooltip-content h4 {
        font-size: 14px;
    }

    .tooltip-content p {
        font-size: 13px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .linkwhisper-tour-overlay,
    .linkwhisper-tour-tooltip,
    .linkwhisper-tour-completion {
        border: 2px solid #000;
    }

    .btn-primary {
        background: #000;
        color: #fff;
        border: 2px solid #000;
    }

    .btn-secondary {
        background: #fff;
        color: #000;
        border: 2px solid #000;
    }

    .step-checkbox {
        border-color: #000;
        background: #000;
    }

    .step-item:not(.completed) .step-checkbox {
        background: #fff;
        color: #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .linkwhisper-tour-spotlight {
        animation: none;
    }

    .linkwhisper-tour-completion {
        animation: none;
    }

    .completion-icon {
        animation: none;
    }

    .progress-fill,
    .btn-primary,
    .btn-secondary,
    .tour-close,
    .step-item,
    .step-checkbox {
        transition: none;
    }
}

/* Focus Management */
.linkwhisper-tour-tooltip:focus-within {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .linkwhisper-tour-overlay,
    .linkwhisper-tour-tooltip,
    .linkwhisper-tour-completion,
    .linkwhisper-tour-spotlight {
        display: none !important;
    }
}