/* Universal scrollbar styling for all scrollable areas */
.fragment-inspector::-webkit-scrollbar,
.writing-prompts::-webkit-scrollbar,
.tool-section::-webkit-scrollbar,
.theme-explorer::-webkit-scrollbar,
.symbol-associations::-webkit-scrollbar,
.sensory-inputs::-webkit-scrollbar,
.sense-notes::-webkit-scrollbar,
#fragment-details::-webkit-scrollbar,
#prompt-generator::-webkit-scrollbar,
#rhythm-analysis::-webkit-scrollbar,
#sound-patterns-viz::-webkit-scrollbar,
#metaphor-generator::-webkit-scrollbar {
    width: 4px;
}

.fragment-inspector::-webkit-scrollbar-track,
.writing-prompts::-webkit-scrollbar-track,
.tool-section::-webkit-scrollbar-track,
.theme-explorer::-webkit-scrollbar-track,
.symbol-associations::-webkit-scrollbar-track,
.sensory-inputs::-webkit-scrollbar-track,
.sense-notes::-webkit-scrollbar-track,
#fragment-details::-webkit-scrollbar-track,
#prompt-generator::-webkit-scrollbar-track,
#rhythm-analysis::-webkit-scrollbar-track,
#sound-patterns-viz::-webkit-scrollbar-track,
#metaphor-generator::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.fragment-inspector::-webkit-scrollbar-thumb,
.writing-prompts::-webkit-scrollbar-thumb,
.tool-section::-webkit-scrollbar-thumb,
.theme-explorer::-webkit-scrollbar-thumb,
.symbol-associations::-webkit-scrollbar-thumb,
.sensory-inputs::-webkit-scrollbar-thumb,
.sense-notes::-webkit-scrollbar-thumb,
#fragment-details::-webkit-scrollbar-thumb,
#prompt-generator::-webkit-scrollbar-thumb,
#rhythm-analysis::-webkit-scrollbar-thumb,
#sound-patterns-viz::-webkit-scrollbar-thumb,
#metaphor-generator::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 2px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .association-container,
    .writer-container,
    .poetry-container,
    .themes-container {
        grid-template-columns: 1fr;
        /* Ensure proper spacing on mobile */
        gap: 1rem;
    }
    
    .mood-container {
        grid-template-columns: 1fr;
    }
    
    .sensory-inputs {
        grid-template-columns: 1fr;
    }
    
    /* Adjust poetry-specific responsive behavior */
    .poetry-container {
        min-height: auto;
        padding-bottom: 1rem;
    }
    
    .tool-section {
        max-height: 250px;
    }
}

@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .tab-content {
        padding: 1rem;
        /* Ensure mobile scrolling works properly */
        min-height: calc(100vh - 160px);
    }
    
    .tool-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .tool-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    /* Poetry-specific mobile adjustments */
    .poetry-container {
        gap: 1rem;
        padding-bottom: 1rem;
    }
    
    .poem-editor {
        min-height: 300px;
        padding: 1rem;
    }
    
    #poem-text {
        min-height: 150px;
        font-size: 1rem;
    }
    
    .tool-section {
        max-height: 200px;
        min-height: 120px;
        padding: 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-color: #ffffff;
        --bg-card: rgba(255, 255, 255, 0.1);
    }
}