/**
 * Product Help Explainer - Frontend Styles
 */

/* Help Button */
.phe-help-button {
    display: inline-block;
    padding: 10px 20px;
    background: #00a77e;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: initial;
    letter-spacing: 0.5px;
}

.phe-help-button:hover {
    background: #008866;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.phe-help-button-container {
    margin: 20px 0;
}

/* Tour Overlay - Container for everything */
.phe-tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99990;
    pointer-events: none;
}

.phe-tour-overlay * {
    pointer-events: auto;
}

/* Backdrop - Invisible click area to close tour */
.phe-tour-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 99991;
    pointer-events: auto;
}

/* Highlighted Element - Strong visual emphasis */
.phe-highlighted {
    position: relative;
    z-index: 99993 !important;
    background: #fffae6 !important;
    border: 3px solid #00a77e !important;
    border-radius: 6px;
    box-shadow: 0 0 30px rgba(0, 167, 126, 0.4), 0 5px 20px rgba(0, 0, 0, 0.2) !important;
    animation: phe-pulse 2s infinite;
}

/* Ensure th elements with phe-highlighted class have black text */
th.phe-highlighted {
    color: #000 !important;
}

/* Highlighted Row */
.phe-highlighted-row {
    position: relative;
    z-index: 99993 !important;
    background: #fffae6 !important;
    box-shadow: 0 0 30px rgba(0, 167, 126, 0.4), 0 5px 20px rgba(0, 0, 0, 0.2) !important;
}

.phe-highlighted-row td,
.phe-highlighted-row th {
    background: #fffae6 !important;
    color: #000 !important;
    text-shadow: none !important;
    border-top: 3px solid #00a77e !important;
    border-bottom: 3px solid #00a77e !important;
}

.phe-highlighted-row td:first-child,
.phe-highlighted-row th:first-child {
    border-left: 3px solid #00a77e !important;
    border-radius: 6px 0 0 6px;
}

.phe-highlighted-row td:last-child,
.phe-highlighted-row th:last-child {
    border-right: 3px solid #00a77e !important;
    border-radius: 0 6px 6px 0;
}

/* Individual highlighted cells within a row */
.phe-highlighted-cell {
    background: #fffae6 !important;
    color: #000 !important;
}

/* Override special field styling when highlighted */
td.special-field.phe-highlighted-cell,
td.special-field-value.phe-highlighted-cell,
.special-field.phe-highlighted-cell,
.special-field-value.phe-highlighted-cell {
    background: #fffae6 !important;
    color: #000 !important;
    border: 3px solid #00a77e !important;
    box-shadow: 0 0 30px rgba(0, 167, 126, 0.4), 0 5px 20px rgba(0, 0, 0, 0.2) !important;
    position: relative;
    z-index: 99993 !important;
}

/* Highlighted Structured Row (for Angus product pages) */
.phe-highlighted-structured-row {
    position: relative;
    z-index: 99993 !important;
    background: #fffae6 !important;
    border: 3px solid #00a77e !important;
    border-radius: 6px;
    padding: 5px !important;
    box-shadow: 0 0 30px rgba(0, 167, 126, 0.4), 0 5px 20px rgba(0, 0, 0, 0.2) !important;
    animation: phe-pulse 2s infinite;
}

.phe-highlighted-structured-row .info-label-structured,
.phe-highlighted-structured-row .info-value-structured {
    background: #fffae6 !important;
    color: #000 !important;
    font-weight: 600 !important;
}

/* Highlighted Column */
.phe-highlighted-column {
    position: relative;
    z-index: 99993 !important;
    background: #fffae6 !important;
    color: #333 !important;
    text-shadow: none !important;
    box-shadow: 0 0 15px rgba(0, 167, 126, 0.3) !important;
    border-left: 3px solid #00a77e !important;
    border-right: 3px solid #00a77e !important;
}

/* Specifically for th elements in highlighted columns */
th.phe-highlighted-column {
    color: #000 !important;
    font-weight: bold !important;
}

@keyframes phe-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 167, 126, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 167, 126, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 167, 126, 0);
    }
}

/* Tooltip - Highest z-index to appear above everything */
.phe-tour-tooltip {
    position: fixed; /* Using fixed for viewport-relative positioning */
    background: white;
    border-radius: 8px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3), 0 0 0 3px #00a77e;
    max-width: 400px;
    min-width: 300px;
    z-index: 99999;
    animation: phe-fadeIn 0.3s ease;
    border: 1px solid #00a77e;
}

@keyframes phe-fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Tooltip Arrow */
.phe-tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.phe-arrow-top .phe-tooltip-arrow {
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0 10px;
    border-color: white transparent transparent transparent;
}

.phe-arrow-bottom .phe-tooltip-arrow {
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 10px 10px 10px;
    border-color: transparent transparent white transparent;
}

.phe-arrow-left .phe-tooltip-arrow {
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent white;
}

.phe-arrow-right .phe-tooltip-arrow {
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 10px 10px 0;
    border-color: transparent white transparent transparent;
}

/* Tooltip Header - Now draggable */
.phe-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    background: #164170;
    color: white;
    border-radius: 8px 8px 0 0;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.phe-tooltip-header:hover {
    background: #1a4a7f;
}

.phe-tooltip-header:active,
.phe-dragging .phe-tooltip-header {
    cursor: grabbing !important;
}

/* Visual feedback when dragging */
.phe-dragging {
    opacity: 0.95;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 3px #00a77e !important;
}

/* Add move icon to indicate draggability */
.phe-tooltip-header::before {
    content: "⋮⋮";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 5px;
    font-size: 10px;
    opacity: 0.5;
    letter-spacing: 2px;
}

.phe-tooltip-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.phe-tooltip-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.phe-tooltip-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Tooltip Content */
.phe-tooltip-content {
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    max-height: 300px;
    overflow-y: auto;
}

.phe-tooltip-content p {
    margin: 0 0 10px;
}

.phe-tooltip-content p:last-child {
    margin-bottom: 0;
}

/* Tooltip Footer */
.phe-tooltip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.phe-step-counter {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

.phe-current-step {
    color: #164170;
    font-weight: 700;
}

/* Navigation Buttons */
.phe-tooltip-buttons {
    display: flex;
    gap: 10px;
}

.phe-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.phe-btn-prev {
    background: #e9ecef;
    color: #495057;
}

.phe-btn-prev:hover:not(:disabled) {
    background: #dee2e6;
}

.phe-btn-prev:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.phe-btn-next,
.phe-btn-finish {
    background: #00a77e;
    color: white;
}

.phe-btn-next:hover,
.phe-btn-finish:hover {
    background: #008866;
}

/* Removed spotlight effect - no longer using dark overlay */

/* Responsive Design */
@media (max-width: 768px) {
    .phe-tour-tooltip {
        max-width: 90%;
        min-width: 250px;
    }
    
    .phe-tooltip-content {
        max-height: 200px;
    }
    
    .phe-help-button {
        font-size: 12px;
        padding: 8px 16px;
    }
    
    .phe-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Admin Styles */
.phe-step {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 15px;
    padding: 15px;
}

.phe-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.phe-step-number {
    font-weight: 600;
    color: #164170;
}

.phe-remove-step {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
}

.phe-step-content label {
    display: block;
    margin-bottom: 10px;
}

.phe-step-content input[type="text"],
.phe-step-content textarea,
.phe-step-content select {
    width: 100%;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
}