/* Pattern Gallery Styles - Dark Theme */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-card: #1c2128;
    --bg-hover: #2d333b;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --border-light: #484f58;
    
    /* Pattern colors */
    --bullish-color: #3fb950;
    --bearish-color: #f85149;
    --neutral-color: #8b949e;
    
    /* Badge colors */
    --badge-bullish: #238636;
    --badge-bearish: #da3633;
    --badge-neutral: #484f58;
    --badge-reversal: #a371f7;
    --badge-continuation: #58a6ff;
    --badge-indecision: #768390;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* Reset and Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* Header */
.header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.header-nav {
    display: flex;
    gap: 1rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.nav-link:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

/* Controls Section */
.controls-section {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.search-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--border-light);
    background-color: var(--bg-primary);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
}

.filter-container {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.375rem 0.75rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.filter-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.filter-btn.active {
    background-color: var(--border-light);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.stats-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Gallery Section */
.gallery-section {
    margin-bottom: 2rem;
}

.pattern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Pattern Card */
.pattern-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.pattern-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.pattern-card.hidden {
    display: none;
}

.card-chart-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.card-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.card-code {
    font-size: 0.6875rem;
    font-family: 'SF Mono', 'Consolas', 'Liberation Mono', Menlo, monospace;
    background-color: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.card-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: capitalize;
}

.badge-bullish {
    background-color: rgba(63, 185, 80, 0.15);
    color: var(--bullish-color);
}

.badge-bearish {
    background-color: rgba(248, 81, 73, 0.15);
    color: var(--bearish-color);
}

.badge-neutral {
    background-color: rgba(139, 148, 158, 0.15);
    color: var(--neutral-color);
}

.badge-category {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-reversal {
    background-color: rgba(163, 113, 247, 0.15);
    color: var(--badge-reversal);
}

.badge-continuation {
    background-color: rgba(88, 166, 255, 0.15);
    color: var(--badge-continuation);
}

.badge-indecision {
    background-color: rgba(118, 131, 144, 0.15);
    color: var(--badge-indecision);
}

.badge-reliability {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
}

.card-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
    padding: 2rem;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    z-index: 10;
}

.modal-close:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.modal-header {
    position: relative;
}

.modal-chart-container {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-title-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.modal-pattern-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-pattern-code {
    font-size: 0.875rem;
    font-family: 'SF Mono', 'Consolas', 'Liberation Mono', Menlo, monospace;
    background-color: var(--bg-tertiary);
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    color: var(--text-secondary);
}

.modal-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.modal-badges .badge {
    font-size: 0.75rem;
}

.modal-section {
    margin-bottom: 1.25rem;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.modal-text {
    font-size: 0.9375rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    gap: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 1.5rem;
}

.modal-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.info-value.code {
    font-family: 'SF Mono', 'Consolas', 'Liberation Mono', Menlo, monospace;
    font-size: 0.8125rem;
    font-weight: 400;
    background-color: var(--bg-tertiary);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer a {
    color: var(--text-primary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .pattern-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .header-nav {
        width: 100%;
        justify-content: center;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .controls-section {
        padding: 1rem;
    }
    
    .filter-container {
        gap: 1rem;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-buttons {
        justify-content: flex-start;
    }
    
    .pattern-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }
    
    .modal {
        margin: 1rem;
        max-height: 95vh;
    }
    
    .modal-chart-container {
        max-width: 250px;
    }
    
    .modal-title-section {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .pattern-grid {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Animation for cards */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pattern-card {
    animation: fadeIn 0.3s ease forwards;
}

.pattern-card:nth-child(1) { animation-delay: 0.02s; }
.pattern-card:nth-child(2) { animation-delay: 0.04s; }
.pattern-card:nth-child(3) { animation-delay: 0.06s; }
.pattern-card:nth-child(4) { animation-delay: 0.08s; }
.pattern-card:nth-child(5) { animation-delay: 0.10s; }
.pattern-card:nth-child(6) { animation-delay: 0.12s; }
.pattern-card:nth-child(7) { animation-delay: 0.14s; }
.pattern-card:nth-child(8) { animation-delay: 0.16s; }
.pattern-card:nth-child(9) { animation-delay: 0.18s; }
.pattern-card:nth-child(10) { animation-delay: 0.20s; }
