/* SH+ Pattern Dictionary Styles */

:root {
    --primary-color: #3b82f6;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-hover: #f3f4f6;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #60a5fa;
        --border-color: #374151;
        --card-bg: #1f2937;
        --bg-secondary: #111827;
        --bg-hover: #374151;
        --text-secondary: #9ca3af;
        --text-muted: #6b7280;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-secondary);
    color: #111827;
}

.sh-plus-container,
.sh-plus-dense {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.sh-header {
    text-align: center;
    margin-bottom: 2rem;
}

.sh-header h1 {
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Pattern Set Toggle */
.pattern-set-toggle {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
    justify-content: center;
}

.pattern-set-toggle button {
    padding: 0.75rem 1.25rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-weight: 500;
}

.pattern-set-toggle button:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.pattern-set-toggle button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Search Container */
.search-container {
    text-align: center;
    margin: 1.5rem 0;
}

.search-input {
    width: 100%;
    max-width: 600px;
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    transition: border-color 0.2s;
}

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

.search-hint {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* View Toggle */
.view-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.view-toggle button {
    padding: 0.5rem 1.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.view-toggle button:hover {
    background: var(--bg-hover);
}

.view-toggle button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Pattern Grid (Card View) */
.pattern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.pattern-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    background: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s;
}

.pattern-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pattern-id {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
}

.pattern-name {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #111827;
}

.pattern-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.tier-indicator {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Dense View Table */
.pattern-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.pattern-table thead {
    background: var(--primary-color);
    color: white;
}

.pattern-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.pattern-table td {
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--border-color);
}

.pattern-table tbody tr:hover {
    background: var(--bg-hover);
}

.pattern-table .pattern-id {
    font-size: 1.1rem;
    color: var(--primary-color);
}

.pattern-table code {
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: 8px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 1001;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #111827;
}

.modal-content h2 {
    margin-top: 0;
    color: var(--primary-color);
}

.modal-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #111827;
}

.modal-content .aliases {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal-content .aliases div {
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.modal-content code {
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.modal-content ul {
    padding-left: 1.5rem;
}

.modal-content li {
    margin: 0.5rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sh-plus-container,
    .sh-plus-dense {
        padding: 1rem;
    }

    .sh-header h1 {
        font-size: 2rem;
    }

    .pattern-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .pattern-set-toggle {
        justify-content: flex-start;
        overflow-x: auto;
    }

    .pattern-table {
        font-size: 0.9rem;
    }

    .pattern-table th,
    .pattern-table td {
        padding: 0.5rem;
    }

    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
        max-width: calc(100% - 2rem);
    }
}
