/**
 * TechnoGene Core Plugin Styles
 * RTL-Friendly and Ahura Theme Compatible
 * 
 * @package TechnoGene_Core
 * @version 1.0.0
 */

/* Smooth scrolling ONLY for plugin content areas */
.tg-content-area,
.tg-main-container,
.single-academy {
    scroll-behavior: smooth;
}

/* ============================================
   TEMPLATE LAYOUT - HERO & CONTAINERS
   ============================================ */

/* Hero Section */
.tg-hero-section {
    position: relative;
    min-height: 400px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin-block-end: 0;
}

.tg-hero-overlay {
    background: linear-gradient(135deg, rgba(32, 128, 145, 0.85) 0%, rgba(31, 33, 33, 0.85) 100%);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}

.tg-hero-content {
    max-width: 1280px;
    width: 100%;
    text-align: center;
}

.tg-hero-title {
    color: #FFFFFF;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin-block-end: 1.5rem;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    line-height: 1.3;
}

.tg-post-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    color: #FFFFFF;
    font-size: 0.875rem;
}

.tg-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tg-meta-item i {
    font-size: 1.25rem;
}

/* Main Container - Two Column Layout */
.tg-main-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-start;
}

/* Content Area (70%) */
.tg-content-area {
    flex: 1;
    min-width: 0;
    /* Prevent flex overflow */
}

/* Sticky Sidebar (30%) */
.tg-sidebar {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #208091 #f5f5f5;
}

.tg-sidebar::-webkit-scrollbar {
    width: 6px;
}

.tg-sidebar::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

.tg-sidebar::-webkit-scrollbar-thumb {
    background: #208091;
    border-radius: 3px;
}

/* Responsive Layout */
@media (max-width: 991px) {
    .tg-main-container {
        flex-direction: column;
    }

    .tg-sidebar {
        width: 100%;
        order: 2;
        position: static;
        max-height: none;
    }

    .tg-content-area {
        order: 1;
    }
}

@media (max-width: 768px) {
    .tg-hero-overlay {
        min-height: 300px;
    }

    .tg-post-meta {
        font-size: 0.75rem;
        gap: 1rem;
    }

    .tg-main-container {
        padding: 1.5rem 1rem;
        gap: 1.5rem;
    }
}

/* ============================================
   SIDEBAR WIDGETS
   ============================================ */

.tg-widget {
    background: #FFFFFF;
    border: 1px solid #E0E0E0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-block-end: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tg-widget-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #208091;
    margin-block-end: 1rem;
    padding-block-end: 0.75rem;
    border-block-end: 2px solid #E6F4F6;
}

/* Table of Contents */
.tg-toc-nav {
    font-size: 0.9375rem;
}

.tg-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tg-toc-list li {
    margin-block-end: 0.75rem;
}

.tg-toc-list a {
    color: #1F2121;
    text-decoration: none;
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.tg-toc-list a:hover {
    background: #E6F4F6;
    color: #208091;
    transform: translateX(-4px);
}

[dir="rtl"] .tg-toc-list a:hover {
    transform: translateX(4px);
}

.tg-toc-sublist {
    list-style: none;
    padding-inline-start: 1.25rem;
    margin-block-start: 0.5rem;
}

.tg-toc-sublist li {
    margin-block-end: 0.5rem;
}

.tg-toc-sublist a {
    font-size: 0.875rem;
    color: #666;
}

/* Learning Widget */
.tg-learning-widget {
    background: linear-gradient(135deg, #E6F4F6 0%, #F5F5F5 100%);
    border-color: #208091;
}

.tg-learning-widget .tg-widget-title {
    color: #208091 !important;
}

.tg-learning-widget .tg-objectives-list li {
    color: #333 !important;
    background: rgba(255, 255, 255, 0.8);
    border-inline-start-color: #208091;
    padding-inline-end: 40px !important;
    /* RTL: padding-right for icon space */
    list-style: none;
}

.tg-learning-widget .tg-objectives-list li::before {
    background: #208091;
    color: white;
    position: absolute;
    inset-inline-end: 10px;
    /* RTL: position from right */
    top: 50%;
    transform: translateY(-50%);
}

/* Info Widget */
.tg-info-content p {
    margin-block-end: 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.tg-info-content strong {
    color: #208091;
    font-weight: 600;
}

/* Share Buttons */
.tg-share-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tg-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #F5F5F5;
    font-size: 1.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tg-share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tg-share-twitter:hover {
    background: #1DA1F2;
}

.tg-share-facebook:hover {
    background: #1877F2;
}

.tg-share-linkedin:hover {
    background: #0A66C2;
}

.tg-share-telegram:hover {
    background: #0088CC;
}

/* ============================================
   CONTENT SECTIONS
   ============================================ */

/* Summary Box */
.tg-summary-box {
    background: linear-gradient(135deg, #F8F9FA 0%, #E6F4F6 100%);
    padding: 2rem;
    border-radius: 12px;
    margin-block-end: 2rem;
    border-inline-start: 5px solid #208091;
}

.tg-summary-content {
    line-height: 1.8;
    color: #1F2121;
}

/* Main Content */
.tg-main-content {
    margin-block-end: 3rem;
}

.tg-main-content p {
    line-height: 1.8;
    margin-block-end: 1.25rem;
}

.tg-main-content h2,
.tg-main-content h3,
.tg-main-content h4 {
    margin-block-start: 2rem;
    margin-block-end: 1rem;
    color: #1F2121;
}

.tg-main-content ul,
.tg-main-content ol {
    margin-block-end: 1.5rem;
    padding-inline-start: 2rem;
}

.tg-main-content li {
    margin-block-end: 0.5rem;
    line-height: 1.7;
}

/* Post Navigation */
.tg-post-navigation {
    margin-block: 3rem;
    padding-block: 2rem;
    border-block-start: 2px solid #E0E0E0;
    border-block-end: 2px solid #E0E0E0;
}

.tg-post-navigation .nav-links {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.tg-post-navigation .nav-subtitle {
    display: block;
    font-size: 0.875rem;
    color: #666;
    margin-block-end: 0.5rem;
}

.tg-post-navigation .nav-title {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    color: #208091;
}

.tg-post-navigation a {
    text-decoration: none;
    transition: transform 0.3s ease;
    display: block;
}

.tg-post-navigation a:hover {
    transform: translateX(-5px);
}

[dir="rtl"] .tg-post-navigation a:hover {
    transform: translateX(5px);
}

/* Comments Section */
.tg-comments-section {
    margin-block-start: 3rem;
    padding-block-start: 2rem;
    border-block-start: 2px solid #E0E0E0;
}

/* ============================================

.tg-field-content,
.tg-list,
.tg-learning-objectives,
.tg-quiz-section,
.tg-trouble-wrapper,
.tg-steps-wrapper,
.tg-related-products {
    box-sizing: border-box;
}

.tg-field-content *,
.tg-list *,
.tg-learning-objectives *,
.tg-quiz-section *,
.tg-trouble-wrapper *,
.tg-steps-wrapper *,
.tg-related-products * {
    box-sizing: inherit;
}

/* ============================================
   SECTION TITLES
   ============================================ */

.tg-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-block-start: 2rem;
    margin-block-end: 1.5rem;
    padding-block-end: 0.75rem;
    border-block-end: 3px solid #3498db;
    position: relative;
}

.tg-section-title::after {
    content: '';
    position: absolute;
    inset-block-end: -3px;
    inset-inline-start: 0;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
}

/* RTL adjustments */
[dir="rtl"] .tg-section-title::after {
    inset-inline-start: auto;
    inset-inline-end: 0;
}

/* ============================================
   LISTS
   ============================================ */

.tg-list,
.tg-objectives-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.tg-list li,
.tg-objectives-list li {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    padding-inline-start: 2.5rem;
    /* Space for icon on start side */
    padding-inline-end: 1rem;
    margin-block-end: 0.75rem;
    background: #f8f9fa;
    border-inline-start: 4px solid #3498db;
    border-radius: 8px;
    position: relative;
    transition: all 0.3s ease;
    list-style: none;
}

.tg-list li:hover,
.tg-objectives-list li:hover {
    background: #e8f4f8;
    transform: translateX(-5px);
}

[dir="rtl"] .tg-list li:hover,
[dir="rtl"] .tg-objectives-list li:hover {
    transform: translateX(5px);
}

.tg-list li::before,
.tg-objectives-list li::before {
    content: '✓';
    position: absolute;
    inset-inline-start: 0.75rem;
    inset-block-start: 0.75rem;
    width: 24px;
    height: 24px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: bold;
}

/* ============================================
   LEARNING OBJECTIVES
   ============================================ */

.tg-learning-objectives {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
    border-radius: 12px;
    color: white;
    margin: 2rem 0;
}

.tg-learning-objectives .tg-section-title {
    color: white;
    border-block-end-color: rgba(255, 255, 255, 0.3);
}

.tg-learning-objectives .tg-section-title::after {
    background: linear-gradient(90deg, #ffd89b, #19547b);
}

.tg-learning-objectives .tg-objectives-list li {
    background: rgba(255, 255, 255, 0.15);
    border-inline-start-color: #ffd89b;
    color: white;
    backdrop-filter: blur(10px);
    padding-inline-end: 40px;
    /* RTL: Extra padding for icon */
    position: relative;
    /* Required for absolute positioning */
}

.tg-learning-objectives .tg-objectives-list li:hover {
    background: rgba(255, 255, 255, 0.25);
}

.tg-learning-objectives .tg-objectives-list li::before {
    background: #ffd89b;
    color: #667eea;
    position: absolute;
    right: 10px;
    /* RTL: Position icon on the right */
    top: 50%;
    transform: translateY(-50%);
}

/* ============================================
   QUIZ QUESTIONS
   ============================================ */

.tg-quiz-section {
    margin: 2rem 0;
}

.tg-quiz-item {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-block-end: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.tg-quiz-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-color: #3498db;
}

.tg-quiz-question {
    font-size: 1.125rem;
    font-weight: 600;
    color: #2c3e50;
    margin-block-end: 1rem;
    padding-inline-start: 2rem;
    position: relative;
}

.tg-quiz-question::before {
    content: '❓';
    position: absolute;
    inset-inline-start: 0;
    font-size: 1.5rem;
}

.tg-quiz-answer {
    padding: 1rem;
    background: #f8f9fa;
    border-inline-start: 4px solid #2ecc71;
    border-radius: 6px;
    line-height: 1.7;
}

/* ============================================
   TROUBLESHOOTING TABLE
   ============================================ */

.tg-trouble-wrapper {
    margin: 2rem 0;
}

.tg-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1rem 0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tg-trouble-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.tg-trouble-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tg-trouble-table th {
    padding: 1rem 1.5rem;
    text-align: start;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tg-trouble-table td {
    padding: 1.25rem 1.5rem;
    text-align: start;
    border-block-end: 1px solid #e0e0e0;
    vertical-align: top;
}

/* Zebra striping */
.tg-trouble-table tbody tr:nth-child(odd) {
    background: #f8f9fa;
}

.tg-trouble-table tbody tr:nth-child(even) {
    background: white;
}

.tg-trouble-table tbody tr:hover {
    background: #e8f4f8;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Responsive table for mobile */
@media (max-width: 768px) {
    .tg-trouble-table {
        border: 0;
    }

    .tg-trouble-table thead {
        display: none;
    }

    .tg-trouble-table tr {
        display: block;
        margin-block-end: 1rem;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .tg-trouble-table td {
        display: block;
        text-align: end;
        padding: 0.75rem 1rem;
        border: none;
        position: relative;
        padding-inline-start: 50%;
    }

    .tg-trouble-table td::before {
        content: attr(data-label);
        position: absolute;
        inset-inline-start: 1rem;
        inset-block-start: 0.75rem;
        font-weight: 700;
        color: #667eea;
    }

    .tg-trouble-table tbody tr:nth-child(odd),
    .tg-trouble-table tbody tr:nth-child(even) {
        background: white;
    }
}

/* ============================================
   PROCEDURE STEPS
   ============================================ */

.tg-steps-wrapper {
    margin: 2rem 0;
}

.tg-step-item {
    display: flex;
    gap: 1.5rem;
    margin-block-end: 2rem;
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.tg-step-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.tg-step-number {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.tg-step-content {
    flex: 1;
}

.tg-step-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin-block-end: 1rem;
}

.tg-step-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-block: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tg-step-description {
    line-height: 1.7;
    color: #34495e;
}

.tg-step-description p {
    margin-block-end: 0.75rem;
}

.tg-step-description ul,
.tg-step-description ol {
    padding-inline-start: 1.5rem;
    margin-block-end: 0.75rem;
}

/* ============================================
   SAFETY BOX
   ============================================ */

.tg-safety-box {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    border-inline-start: 6px solid #ffd89b;
    box-shadow: 0 4px 16px rgba(245, 87, 108, 0.3);
    position: relative;
    overflow: hidden;
}

.tg-safety-box::before {
    content: '⚠️';
    position: absolute;
    inset-inline-end: 1rem;
    inset-block-start: 1rem;
    font-size: 4rem;
    opacity: 0.2;
}

.tg-safety-box h3,
.tg-safety-box h4,
.tg-safety-box strong {
    color: white;
}

.tg-safety-box ul,
.tg-safety-box ol {
    margin-block-start: 1rem;
    padding-inline-start: 1.5rem;
}

.tg-safety-box li {
    margin-block-end: 0.5rem;
    line-height: 1.6;
}

/* ============================================
   PRODUCT CARDS
   ============================================ */

.tg-related-products {
    margin: 3rem 0;
}

.tg-products-grid {
    display: grid;
    gap: 2rem;
    margin-block-start: 2rem;
}

.tg-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.tg-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.tg-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive grid */
@media (max-width: 1024px) {
    .tg-cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {

    .tg-cols-3,
    .tg-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {

    .tg-cols-2,
    .tg-cols-3,
    .tg-cols-4 {
        grid-template-columns: 1fr;
    }
}

.tg-product-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tg-product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-color: #3498db;
}

.tg-product-image {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
}

.tg-product-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.tg-product-card:hover .tg-product-image img {
    transform: scale(1.08);
}

.tg-product-info {
    padding: 1.5rem;
}

.tg-product-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-block-end: 0.75rem;
}

.tg-product-title a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.tg-product-title a:hover {
    color: #3498db;
}

.tg-product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2ecc71;
    margin-block-end: 1rem;
}

.tg-product-price del {
    font-size: 0.875rem;
    color: #95a5a6;
    margin-inline-end: 0.5rem;
}

.tg-product-actions {
    margin-block-start: 1rem;
}

/* ============================================
   BUTTONS
   ============================================ */

.tg-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    width: 100%;
}

.tg-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tg-btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
    color: white;
}

.tg-btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.tg-btn-secondary:hover {
    background: #d5dbdb;
}

/* ============================================
   ERROR & INFO MESSAGES
   ============================================ */

.tg-error,
.tg-info {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
}

.tg-error {
    background: #ffe6e6;
    color: #c0392b;
    border-inline-start: 4px solid #e74c3c;
}

.tg-info {
    background: #e8f4f8;
    color: #2980b9;
    border-inline-start: 4px solid #3498db;
}

/* ============================================
   RTL FORCE CLASS (for formulas, code, etc.)
   ============================================ */

.tg-force-ltr {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: embed;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.tg-product-card:focus-within,
.tg-step-item:focus-within,
.tg-quiz-item:focus-within {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}