/**
 * Comprehensive Guide Component Styles
 * Used across all PeakPro Tools
 * 
 * AdSense Compatibility:
 * - Z-index values are set below AdSense overlays (2147483647)
 * - Guide button positioned to avoid anchor ad conflicts
 * - Panel width adjusted to not cover ads
 * - Proper spacing maintained for ad visibility
 */

/* Guide Button */
.guide-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    transition: all 0.3s ease;
}

/* Adjust position if AdSense anchor ad is present */
body.has-anchor-ad .guide-trigger {
    bottom: 120px;
}

.guide-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    background: var(--primary-dark);
}

.guide-trigger:active {
    transform: scale(0.95);
}

/* Guide Overlay */
.guide-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

/* Ensure AdSense ads stay above guide overlay when needed */
.guide-overlay.active ~ ins.adsbygoogle {
    z-index: 1000001 !important;
}

.guide-overlay.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Guide Panel */
.guide-panel {
    position: fixed;
    top: 0;
    right: -600px;
    width: 100%;
    max-width: 600px;
    height: 100%;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 1000001;
    overflow-y: auto;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Prevent AdSense ads from appearing inside guide panel */
.guide-panel ins.adsbygoogle {
    display: none !important;
}

.guide-panel.active {
    right: 0;
}

.guide-header {
    background: var(--primary-color);
    color: white;
    padding: 30px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.guide-header h2 {
    margin: 0 0 8px 0;
    font-size: 2rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.guide-header p {
    margin: 0;
    opacity: 0.95;
    font-size: 1.05rem;
}

.guide-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.guide-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.guide-content {
    padding: 30px;
}

/* Table of Contents */
.guide-toc {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    border-left: 4px solid var(--primary-color);
}

.guide-toc h3 {
    margin: 0 0 16px 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.guide-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.guide-toc li {
    margin-bottom: 10px;
}

.guide-toc a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border-radius: 6px;
}

.guide-toc a:hover {
    background: white;
    transform: translateX(4px);
}

.guide-toc a::before {
    content: "→";
    opacity: 0.6;
}

/* Guide Sections */
.guide-section {
    margin-bottom: 40px;
    scroll-margin-top: 100px;
}

.guide-section h3 {
    font-size: 1.6rem;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.guide-section h3 .icon {
    font-size: 1.8rem;
}

.guide-section h4 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 24px 0 12px 0;
}

.guide-section p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
}

.guide-section ul,
.guide-section ol {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
    padding-left: 24px;
}

.guide-section li {
    margin-bottom: 8px;
}

.guide-section strong {
    color: var(--text-primary);
}

/* Feature Cards */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.feature-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.feature-card h5 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.feature-card p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Tips & Notes */
.guide-tip {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.guide-tip strong {
    color: #1976d2;
    display: block;
    margin-bottom: 8px;
}

.guide-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.guide-warning strong {
    color: #f57c00;
    display: block;
    margin-bottom: 8px;
}

.guide-success {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.guide-success strong {
    color: #2e7d32;
    display: block;
    margin-bottom: 8px;
}

/* Code Examples */
.guide-code {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Steps */
.guide-steps {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
}

.guide-steps li {
    counter-increment: step-counter;
    position: relative;
    padding-left: 60px;
    margin-bottom: 30px;
}

.guide-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.guide-steps li strong {
    display: block;
    font-size: 1.15rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* Use Cases */
.use-case-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.use-case {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border);
}

.use-case h5 {
    margin: 0 0 12px 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.use-case p {
    margin: 0;
    color: var(--text-secondary);
}

/* FAQ */
.faq-item {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.faq-answer {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .guide-trigger {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .guide-panel {
        max-width: 100%;
    }

    .guide-header {
        padding: 20px;
    }

    .guide-header h2 {
        font-size: 1.5rem;
    }

    .guide-content {
        padding: 20px;
    }

    .feature-cards {
        grid-template-columns: 1fr;
    }

    .guide-steps li {
        padding-left: 50px;
    }

    .guide-steps li::before {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}
