/*
Theme Name: TudienWiki
Theme URI: https://tudienwiki.com
Description: Modern encyclopedia theme powered by TailwindCSS
Version: 2.0
Author: TudienWiki Team
*/

/* ==========================================================================
   Base Styles & Resets
   ========================================================================== */

*,
:after,
:before {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background: #f9fafb;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: 'Linux Libertine', 'Palatino Linotype', 'Times New Roman', Georgia, serif;
    font-weight: 600;
    line-height: 1.3;
    color: #111827;
}

a {
    text-decoration: none;
    color: #2563eb;
    transition: all 0.2s ease;
}

a:hover {
    color: #1d4ed8;
}

/* ==========================================================================
   Layout Utilities
   ========================================================================== */

.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* ==========================================================================
   Infobox Styles (Wikipedia-inspired but modern)
   CRITICAL: Preserve table structure for ACF compatibility
   ========================================================================== */

.infobox {
    float: right;
    clear: right;
    margin: 0.5rem 0 1rem 1.5rem;
    width: 100%;
    max-width: 320px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    font-size: 0.875rem;
    line-height: 1.5;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.infobox:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.infobox .wp-caption {
    margin-bottom: 0;
    width: 100% !important;
}

.infobox th.info-post_title {
    padding: 1rem;
    text-align: center;
    vertical-align: middle;
    line-height: 1.2;
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%);
    border: none;
}

.infobox img {
    width: auto;
    max-width: 100%;
    height: auto;
    border-radius: 0.25rem;
}

.infobox th.info-group_title {
    text-align: center;
    padding: 0.5rem;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    font-weight: 600;
    color: #374151;
    border: none;
}

.infobox td {
    padding: 0.75rem;
    min-width: 100px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

.infobox td:first-child {
    font-weight: 600;
    color: #4b5563;
}

.infobox .ba-tbl {
    border: none;
    width: 100%;
    background-color: transparent;
    margin: 0;
}

.infobox .ba-tbl th {
    width: 50%;
    vertical-align: top;
    border: none;
    padding: 0.5rem;
    background: transparent;
}

.infobox .ba-tbl th a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #2563eb;
    transition: color 0.2s ease;
}

.infobox .ba-tbl th a:hover {
    color: #1d4ed8;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .infobox {
        float: none;
        margin: 1rem auto;
        max-width: 100%;
    }
}

/* ==========================================================================
   Table of Contents (TOC)
   ========================================================================== */

#toc {
    display: inline-block;
    padding: 1.25rem;
    margin: 1.5rem 0;
    border: 1px solid #d1d5db;
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    font-size: 0.9rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#toc:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#toc .toctitle {
    text-align: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

#toc .toctitle h4 {
    font-size: 1.1rem;
    color: #111827;
    display: inline;
    font-weight: 700;
    margin: 0;
}

#toc .toctoggle {
    margin-left: 0.5rem;
    font-size: 0.875rem;
}

#toc .toctoggle a {
    color: #6b7280;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

#toc .toctoggle a:hover {
    background: #f3f4f6;
    color: #3b82f6;
}

#toc ol {
    padding-left: 1.5rem;
    margin: 0;
}

#toc ol li {
    margin: 0.5rem 0;
}

#toc a.wk_toc {
    color: #374151;
    transition: color 0.2s ease;
}

#toc a.wk_toc:hover {
    color: #2563eb;
}

/* ==========================================================================
   Content Styles
   ========================================================================== */

.single-content {
    text-align: justify;
    line-height: 1.8;
    color: #374151;
}

.single-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
    font-size: 1.875rem;
    color: #111827;
}

.single-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.single-content p {
    margin-bottom: 1.25rem;
}

.single-content ul,
.single-content ol {
    margin-bottom: 1.25rem;
    padding-left: 2rem;
}

.single-content ul li {
    list-style: disc;
    margin-bottom: 0.5rem;
}

.single-content ol li {
    list-style: decimal;
    margin-bottom: 0.5rem;
}

.single-content ul li.wpuf-el,
.single-content ul li.wpuf-submit {
    list-style: none !important;
}

/* ==========================================================================
   Image Alignment (WordPress)
   ========================================================================== */

.alignleft,
img.alignleft {
    margin-right: 1.5rem;
    margin-bottom: 1rem;
    display: inline;
    float: left;
}

.alignright,
img.alignright {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    display: inline;
    float: right;
}

.aligncenter,
img.aligncenter {
    margin: 1.5rem auto;
    display: block;
    clear: both;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    max-width: 98.5%;
    height: auto;
}

.wp-caption {
    margin-bottom: 1.5rem;
    text-align: center;
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 0.5rem;
}

.wp-caption img {
    border: 0 none;
    padding: 0;
    margin: 0;
    max-width: 100%;
    height: auto;
}

.wp-caption p.wp-caption-text {
    line-height: 1.5;
    font-size: 0.875rem;
    margin: 0.5rem 0 0;
    color: #6b7280;
    text-align: center !important;
}

/* ==========================================================================
   Search Suggestions
   ========================================================================== */

.vt-search__suggest {
    background-color: #fff;
    display: none;
    position: absolute;
    margin-top: 0.25rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
}

.vt-search__item {
    border-bottom: 1px solid #f3f4f6;
    color: #111827;
    display: flex;
    padding: 0.75rem;
    text-decoration: none;
    transition: background 0.2s ease;
}

.vt-search__item:hover {
    background: #f9fafb;
}

.vt-search__item:last-child {
    border-bottom: none;
}

.vt-search__avatar {
    width: 60px;
    flex-shrink: 0;
}

.vt-search__img {
    display: block;
    overflow: hidden;
    position: relative;
    padding-top: calc(100% / (55 / 50));
    border-radius: 0.25rem;
}

.vt-search__img img {
    height: 100%;
    left: 0;
    object-fit: cover;
    position: absolute;
    top: 0;
    width: 100%;
}

.vt-search__content {
    flex: 1;
    padding-left: 0.75rem;
}

.vt-search__ttl {
    font-size: 0.95rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

/* ==========================================================================
   Rank Math FAQ Schema
   ========================================================================== */

#rank-math-faq {
    margin-top: 2.5rem;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #3b82f6;
    padding: 1.5rem;
    position: relative;
    background: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

#rank-math-faq .rank-math-question {
    font-style: normal;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.75;
    padding: 1rem 2rem 1rem 0;
    margin: 0;
    color: #111827;
    position: relative;
    cursor: pointer;
    transition: color 0.2s ease;
}

#rank-math-faq .rank-math-question:hover {
    color: #2563eb;
}

#rank-math-faq .rank-math-question:after {
    content: "";
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center;
    position: absolute;
    right: 0;
    top: 50%;
    width: 16px;
    height: 16px;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.3s ease;
}

#rank-math-faq .rank-math-question.faq-active:after {
    transform: translateY(-50%) rotate(180deg);
}

#rank-math-faq .rank-math-list-item:not(:first-child) .rank-math-answer {
    display: none;
}

#rank-math-faq .rank-math-list-item:not(:last-child) {
    border-bottom: 1px solid #f3f4f6;
}

#rank-math-faq .rank-math-answer {
    padding: 0 1rem 1rem;
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* ==========================================================================
   Custom Animations
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

/* ==========================================================================
   Responsive Utilities
   ========================================================================== */

@media (max-width: 480px) {
    .logo {
        margin-bottom: 1rem;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .sidebar,
    .main-bar,
    footer,
    .related,
    .tags {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .infobox {
        float: none;
        page-break-inside: avoid;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

*:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}