/**
 * gToC Public Styles - Advanced Styling System
 *
 * @package GToC
 * @since   1.0.0
 */

/* ==========================================================================
   CSS Variables - Theming System
   ========================================================================== */

:root {
    /* Primary Colors - Default (Light) */
    --gtoc-primary: #84cc16;
    --gtoc-primary-hover: #65a30d;
    --gtoc-text: #1d2327;
    --gtoc-text-muted: #646970;
    --gtoc-border: #c3c4c7;
    --gtoc-bg: #ffffff;
    --gtoc-bg-light: #f0f0f1;
    --gtoc-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --gtoc-radius: 8px;
    --gtoc-spacing: 1rem;
    
    /* Typography */
    --gtoc-font-family: inherit;
    --gtoc-font-size: 1rem;
    --gtoc-font-weight: 400;
}

/* Dark Scheme */
.gtoc-scheme-dark {
    --gtoc-primary: #84cc16;
    --gtoc-primary-hover: #a3e635;
    --gtoc-text: #f0f0f1;
    --gtoc-text-muted: #a7aaad;
    --gtoc-border: #3c3c3c;
    --gtoc-bg: #1a1a1a;
    --gtoc-bg-light: #2a2a2a;
    --gtoc-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Container Base
   ========================================================================== */

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

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

.gtoc-auto-output {
    margin: 2rem 0;
}

.gtoc-container {
    font-family: var(--gtoc-font-family);
    font-size: var(--gtoc-font-size);
    font-weight: var(--gtoc-font-weight);
    line-height: 1.6;
    transition: all 0.3s ease;
}

/* ==========================================================================
   Style: Minimal
   ========================================================================== */

.gtoc-style-minimal {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}

.gtoc-style-minimal .gtoc-header {
    border-bottom: 1px solid var(--gtoc-border);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.gtoc-style-minimal .gtoc-link {
    padding: 0.5rem 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.gtoc-style-minimal .gtoc-link:hover {
    border-bottom-color: var(--gtoc-primary);
}

/* ==========================================================================
   Style: Boxed
   ========================================================================== */

.gtoc-style-boxed {
    background: var(--gtoc-bg-light);
    border: 1px solid var(--gtoc-border);
    border-radius: var(--gtoc-radius);
    padding: 1.5rem;
    box-shadow: var(--gtoc-shadow);
}

.gtoc-style-boxed .gtoc-header {
    border-bottom: 2px solid var(--gtoc-border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.gtoc-style-boxed .gtoc-item {
    background: var(--gtoc-bg);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: calc(var(--gtoc-radius) / 2);
    border: 1px solid var(--gtoc-border);
    transition: all 0.2s ease;
}

.gtoc-style-boxed .gtoc-item:hover {
    border-color: var(--gtoc-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.gtoc-style-boxed .gtoc-link {
    padding: 0;
    border: none;
}

/* ==========================================================================
   Style: Modern
   ========================================================================== */

.gtoc-style-modern {
    background: var(--gtoc-bg);
    border: 2px solid var(--gtoc-primary);
    border-radius: var(--gtoc-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gtoc-style-modern .gtoc-header {
    border-bottom: 2px solid var(--gtoc-primary);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.gtoc-style-modern .gtoc-title {
    color: var(--gtoc-primary);
    font-weight: 700;
    font-size: 1.5rem;
}

.gtoc-style-modern .gtoc-link {
    padding: 0.75rem 1rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.gtoc-style-modern .gtoc-link:hover {
    background: var(--gtoc-bg-light);
    border-left-color: var(--gtoc-primary);
    padding-left: 1.25rem;
}

.gtoc-style-modern .gtoc-link.active {
    background: var(--gtoc-bg-light);
    border-left-color: var(--gtoc-primary);
    font-weight: 600;
}

/* ==========================================================================
   Style: Classic
   ========================================================================== */

.gtoc-style-classic {
    background: var(--gtoc-bg);
    border: 1px solid var(--gtoc-border);
    border-left: 4px solid var(--gtoc-primary);
    border-radius: var(--gtoc-radius);
    padding: 1.5rem;
    box-shadow: var(--gtoc-shadow);
}

.gtoc-style-classic .gtoc-header {
    border-bottom: 1px solid var(--gtoc-border);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.gtoc-style-classic .gtoc-item {
    position: relative;
    margin: 0;
    padding: 0;
}

.gtoc-style-classic .gtoc-link {
    display: block;
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--gtoc-text-muted);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    margin-left: -1.5rem;
    padding-left: 1.5rem;
}

/* Border indikator sa leve strane - prikazuje se samo za aktivni link */
.gtoc-style-classic .gtoc-link.active {
    color: #2271b1;
    font-weight: 500;
    border-left-color: #2271b1;
    background-color: transparent;
}

/* Hover efekat */
.gtoc-style-classic .gtoc-link:hover {
    color: #2271b1;
    border-left-color: rgba(34, 113, 177, 0.5);
}

/* Fokus efekat */
.gtoc-style-classic .gtoc-link:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ==========================================================================
   Header & Title
   ========================================================================== */

.gtoc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gtoc-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gtoc-text);
}

.gtoc-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: calc(var(--gtoc-radius) / 2);
    transition: background-color 0.2s ease;
    color: var(--gtoc-text);
}

.gtoc-toggle:hover {
    background: var(--gtoc-bg-light);
}

.gtoc-toggle-icon {
    width: 20px;
    height: 20px;
    position: relative;
}

.gtoc-toggle-icon::before,
.gtoc-toggle-icon::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 2px;
    background: currentColor;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease;
}

.gtoc-toggle-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.gtoc-container.is-collapsed .gtoc-nav {
    display: none;
}

.gtoc-container.is-collapsed .gtoc-toggle-icon::after {
    transform: translate(-50%, -50%) rotate(0deg);
}

/* ==========================================================================
   Navigation & List
   ========================================================================== */

.gtoc-nav {
    margin: 0;
}

.gtoc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gtoc-item {
    position: relative;
    margin: 0;
    padding: 0;
}

.gtoc-item-level-2 {
    margin-left: 0;
}

.gtoc-item-level-3 {
    margin-left: 1.5rem;
}

.gtoc-item-level-4 {
    margin-left: 3rem;
}

.gtoc-item-level-5 {
    margin-left: 4.5rem;
}

.gtoc-item-level-6 {
    margin-left: 6rem;
}

/* ==========================================================================
   Links
   ========================================================================== */

.gtoc-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: var(--gtoc-text);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.gtoc-link-text {
    flex: 1;
}

.gtoc-link:hover {
    color: var(--gtoc-primary);
}

.gtoc-link:focus {
    outline: 2px solid var(--gtoc-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.gtoc-link.active {
    color: var(--gtoc-primary);
    font-weight: 600;
}

/* ==========================================================================
   Icons
   ========================================================================== */

.gtoc-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 0.875rem;
    color: var(--gtoc-primary);
    transition: transform 0.2s ease;
}

.gtoc-icon-bullet {
    font-size: 1.25rem;
    line-height: 1;
}

.gtoc-icon-arrow {
    font-size: 1rem;
}

.gtoc-icon-number {
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--gtoc-primary);
    color: var(--gtoc-bg);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gtoc-link:hover .gtoc-icon {
    transform: translateX(2px);
}

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

/* Fade Animation */
.gtoc-animation-fade .gtoc-item {
    opacity: 0;
    animation: gtoc-fade-in 0.3s ease forwards;
}

.gtoc-animation-fade .gtoc-item:nth-child(1) { animation-delay: 0.05s; }
.gtoc-animation-fade .gtoc-item:nth-child(2) { animation-delay: 0.1s; }
.gtoc-animation-fade .gtoc-item:nth-child(3) { animation-delay: 0.15s; }
.gtoc-animation-fade .gtoc-item:nth-child(4) { animation-delay: 0.2s; }
.gtoc-animation-fade .gtoc-item:nth-child(5) { animation-delay: 0.25s; }
.gtoc-animation-fade .gtoc-item:nth-child(n+6) { animation-delay: 0.3s; }

@keyframes gtoc-fade-in {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide Animation */
.gtoc-animation-slide .gtoc-item {
    transform: translateX(-20px);
    opacity: 0;
    animation: gtoc-slide-in 0.3s ease forwards;
}

.gtoc-animation-slide .gtoc-item:nth-child(1) { animation-delay: 0.05s; }
.gtoc-animation-slide .gtoc-item:nth-child(2) { animation-delay: 0.1s; }
.gtoc-animation-slide .gtoc-item:nth-child(3) { animation-delay: 0.15s; }
.gtoc-animation-slide .gtoc-item:nth-child(4) { animation-delay: 0.2s; }
.gtoc-animation-slide .gtoc-item:nth-child(5) { animation-delay: 0.25s; }
.gtoc-animation-slide .gtoc-item:nth-child(n+6) { animation-delay: 0.3s; }

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

/* Bounce Animation */
.gtoc-animation-bounce .gtoc-link:hover {
    animation: gtoc-bounce 0.5s ease;
}

@keyframes gtoc-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

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

@media screen and (max-width: 600px) {
    .gtoc-container {
        padding: 1rem;
    }
    
    .gtoc-item-level-3 {
        margin-left: 1rem;
    }
    
    .gtoc-item-level-4 {
        margin-left: 2rem;
    }
    
    .gtoc-item-level-5 {
        margin-left: 3rem;
    }
    
    .gtoc-item-level-6 {
        margin-left: 4rem;
    }
}

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

@media (prefers-reduced-motion: reduce) {
    .gtoc-container,
    .gtoc-link,
    .gtoc-item,
    .gtoc-icon {
        animation: none !important;
        transition: none !important;
    }
}

.gtoc-no-headings {
    color: var(--gtoc-text-muted);
    font-style: italic;
    margin: 0;
    padding: 1rem 0;
}

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

@media print {
    .gtoc-container {
        background: none !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    .gtoc-toggle {
        display: none;
    }
    
    .gtoc-nav {
        display: block !important;
    }
}
