/* ============================================
   MFGHE.COM - Complete Stylesheet
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #fff;
    color: #202124;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   HEADER - FIX: z-index added for clickable links
   ============================================ */
.header {
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e8eaed;
    background: #fff;
    position: relative;
    z-index: 1000; /* FIX: Ensures header stays on top */
}

.logo {
    font-size: 1.5em;
    font-weight: 500;
    color: #5f6368;
    text-decoration: none;
    cursor: pointer;
}

.logo .m { color: #4285f4; }
.logo .f { color: #ea4335; }
.logo .g { color: #fbbc04; }
.logo .h { color: #34a853; }
.logo .e { color: #4285f4; }

.header-nav {
    display: flex;
    gap: 25px;
    align-items: center;
}

.header-nav a {
    color: #5f6368;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
    cursor: pointer; /* FIX: Explicit cursor pointer */
    position: relative; /* FIX: Ensures links are clickable */
}

.header-nav a:hover {
    color: #202124;
    text-decoration: underline;
}

/* ============================================
   MAIN CONTAINER
   ============================================ */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1; /* FIX: Lower than header */
}

/* ============================================
   HOME PAGE
   ============================================ */
.home-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 40px 20px;
    margin-top: -80px;
}

.home-page.hidden {
    display: none;
}

.site-title {
    font-size: 1.4em;
    color: #5f6368;
    margin-bottom: 8px;
    font-weight: 400;
    text-align: center;
    max-width: 700px;
}

.site-subtitle {
    font-size: 1em;
    color: #70757a;
    margin-bottom: 35px;
    font-style: italic;
    text-align: center;
}

.search-box-container {
    width: 100%;
    max-width: 584px;
}

.search-box {
    display: flex;
    align-items: center;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    padding: 10px 15px;
    transition: box-shadow 0.2s;
    background: #fff;
}

.search-box:hover,
.search-box:focus-within {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
    border-color: rgba(223, 225, 229, 0);
}

.search-icon {
    width: 20px;
    height: 20px;
    margin-right: 13px;
    color: #9aa0a6;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    color: #202124;
    background: transparent;
}

.search-input::placeholder {
    color: #9aa0a6;
}

.search-buttons {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    justify-content: center;
}

.search-btn {
    background: #f8f9fa;
    border: 1px solid #f8f9fa;
    border-radius: 4px;
    color: #3c4043;
    font-size: 14px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.1s;
}

.search-btn:hover {
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
    border: 1px solid #dadce0;
    color: #202124;
}

.search-btn-secondary {
    background: #fff;
    border: 1px solid #dadce0;
    color: #5f6368;
}

.search-btn-secondary:hover {
    background: #f8f9fa;
}

/* ============================================
   RESULTS PAGE
   ============================================ */
.results-page {
    display: none;
    flex-direction: column;
    flex: 1;
}

.results-page.active {
    display: flex;
}

.results-header {
    padding: 15px 0;
    border-bottom: 1px solid #e8eaed;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.results-header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 30px;
}

.results-logo {
    font-size: 1.8em;
    font-weight: 400;
    letter-spacing: -1px;
    cursor: pointer;
    color: #5f6368;
}

.results-search-box {
    flex: 1;
    max-width: 600px;
    display: flex;
    align-items: center;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    padding: 8px 15px;
    background: #fff;
}

.results-search-box:hover {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}

.results-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #202124;
}

.results-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

.results-stats {
    color: #70757a;
    font-size: 14px;
    margin-bottom: 20px;
}

/* Result Items */
.result-item {
    margin-bottom: 30px;
    max-width: 800px;
}

.result-source-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.source-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.source-icon.youtube {
    background: #ff0000;
    color: #fff;
}

.source-icon.book {
    background: #34a853;
    color: #fff;
}

.source-icon.web {
    background: #4285f4;
    color: #fff;
}

.source-icon.bamteli {
    background: #34a853;
    color: #fff;
}

.source-icon.herkul {
    background: #4285f4;
    color: #fff;
}

.source-breadcrumb {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #5f6368;
}

.source-name {
    font-weight: 500;
}

.result-link {
    font-size: 20px;
    color: #1a0dab;
    text-decoration: none;
    line-height: 1.3;
    display: block;
    margin-bottom: 3px;
}

.result-link:hover {
    text-decoration: underline;
}

.result-link:visited {
    color: #681da8;
}

.result-snippet {
    color: #4d5156;
    font-size: 14px;
    line-height: 1.58;
}

.result-snippet strong {
    font-weight: 600;
}

.result-metadata {
    color: #70757a;
    font-size: 13px;
    margin-top: 5px;
}

/* Video Results */
.video-result {
    display: flex;
    gap: 15px;
    margin-top: 8px;
}

.video-thumbnail {
    width: 180px;
    height: 101px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-left: 20px solid rgba(255, 255, 255, 0.9);
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    transition: all 0.2s;
}

.video-thumbnail:hover .video-play-icon {
    border-left-color: #fff;
}

.video-info {
    flex: 1;
}

/* Loading Spinner */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
    color: #70757a;
}

.loading.active {
    display: block;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4285f4;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Results */
.no-results {
    display: none;
    text-align: center;
    padding: 60px 20px;
}

.no-results.active {
    display: block;
}

.no-results h2 {
    font-size: 20px;
    color: #202124;
    margin-bottom: 10px;
}

.no-results p {
    color: #70757a;
    font-size: 14px;
}

/* ============================================
   DETAIL PAGE
   ============================================ */
.breadcrumb {
    color: #70757a;
    font-size: 14px;
    margin-bottom: 20px;
}

.breadcrumb a {
    color: #1a0dab;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px;
}

.article-title {
    font-size: 2.2em;
    color: #202124;
    margin-bottom: 20px;
    line-height: 1.3;
}

.source-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.source-info .source-icon {
    width: 24px;
    height: 24px;
    background: #34a853;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.source-text {
    color: #5f6368;
    font-size: 14px;
    flex: 1;
}

.source-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1a73e8;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.source-link-btn:hover {
    background: #1557b0;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin-bottom: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
}

.summary-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #4285f4;
}

.summary-section h2 {
    font-size: 1.3em;
    color: #202124;
    margin-bottom: 10px;
}

.summary-section p {
    color: #3c4043;
    line-height: 1.8;
}

.topics-section {
    margin-bottom: 30px;
}

.topics-section h3 {
    font-size: 1.1em;
    color: #202124;
    margin-bottom: 12px;
}

.topic-tag {
    display: inline-block;
    background: #e8f0fe;
    color: #1967d2;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    margin: 4px;
    text-decoration: none;
}

.topic-tag:hover {
    background: #d2e3fc;
}

.questions-section {
    margin-bottom: 30px;
}

.questions-section h3 {
    font-size: 1.3em;
    color: #202124;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.question-item {
    padding: 12px 15px;
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    margin-bottom: 10px;
    color: #3c4043;
}

.question-item::before {
    content: "💡";
    margin-right: 8px;
}

.original-question {
    background: #fff3e0;
    border-left: 4px solid #fb8c00;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.original-question h3 {
    font-size: 1.1em;
    color: #e65100;
    margin-bottom: 8px;
}

.original-question p {
    color: #3c4043;
    font-size: 1.05em;
    line-height: 1.6;
}

.external-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1a73e8;
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
}

.external-link:hover {
    background: #1557b0;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: #f2f2f2;
    border-top: 1px solid #e4e4e4;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-links {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #70757a;
    text-decoration: none;
    font-size: 14px;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .site-title {
        font-size: 1.1em;
    }

    .site-subtitle {
        font-size: 0.9em;
    }

    .header {
        padding: 10px 15px;
    }

    .header-nav {
        gap: 15px;
    }

    .header-nav a {
        font-size: 12px;
    }

    .results-header-content {
        flex-direction: column;
        gap: 15px;
    }

    .results-search-box {
        max-width: 100%;
    }

    .video-result {
        flex-direction: column;
    }

    .video-thumbnail {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }

    .container {
        padding: 20px 15px;
    }

    .article-title {
        font-size: 1.6em;
    }

    .topic-tag {
        font-size: 12px;
        padding: 5px 12px;
    }

    .source-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .source-link-btn {
        width: 100%;
        justify-content: center;
    }
}