/* Spelling Bee Solver Styles */

.solver-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.solver-card {
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.solver-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-border);
}

.solver-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Honeycomb Grid - True Honeycomb Layout */
.honeycomb-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
}

.honeycomb-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hex-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

/* Offset rows 1 and 3 to create honeycomb interlock */
.hex-row:nth-child(1) {
    margin-bottom: -26px;
    position: relative;
    z-index: 1;
}

.hex-row:nth-child(2) {
    position: relative;
    z-index: 2;
}

.hex-row:nth-child(3) {
    margin-top: -26px;
    position: relative;
    z-index: 1;
}

/* Hexagon using SVG shape */
.hexagon {
    position: relative;
    width: 100px;
    height: 115px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.hexagon:hover {
    transform: scale(1.08);
    z-index: 10;
}

.hexagon:active {
    transform: scale(0.95);
}

/* SVG hexagon styling */
.hexagon svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none; /* Allow clicks to pass through to hexagon */
}

.hexagon svg polygon {
    fill: #e8ebef;
    stroke: none;
    transition: all 0.15s ease;
    pointer-events: none;
}

.hexagon:hover svg polygon {
    fill: #dde0e4;
}

.hexagon.center svg polygon {
    fill: #f7c948;
}

.hexagon.center:hover svg polygon {
    fill: #f5bd2e;
}

.hex-input {
    position: relative;
    z-index: 2;
    width: 70px;
    height: 70px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 2.2rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #1a1a1a;
    outline: none;
    padding: 0;
    cursor: pointer;
    caret-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.hex-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.hex-input:focus::placeholder {
    color: transparent;
}

.hex-input:focus {
    color: #1a1a1a;
}

.hexagon.center .hex-input {
    color: #1a1a1a;
}

/* Blinking cursor indicator when focused */
.hexagon.focused::after {
    content: '|';
    position: absolute;
    z-index: 3;
    font-size: 2.5rem;
    font-weight: 300;
    color: #f7c948;
    animation: blink 1s infinite;
    pointer-events: none;
}

.hexagon.center.focused::after {
    color: #1a1a1a;
}

/* Hide cursor when there's a value */
.hexagon.has-value.focused::after {
    display: none;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Stats Container */
.stats-container {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.stat-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Results Area */
.results-area {
    margin-top: 2rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-light);
}

.results-count {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

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

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-light);
    background: white;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

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

.words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.word-item {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    text-align: center;
    font-weight: 500;
    color: var(--text-main);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.word-item:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.word-item.pangram {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-color: #ffc107;
    font-weight: 700;
    color: #333;
}

.word-item.pangram::after {
    content: '⭐';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 1.2rem;
}

.word-score {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 400;
}

.word-item.pangram .word-score {
    color: #666;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.loading-state {
    text-align: center;
    padding: 3rem 2rem;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .solver-card {
        padding: 1.5rem;
    }
    
    .hexagon {
        width: 75px;
        height: 86px;
    }
    
    .hex-row:nth-child(1) {
        margin-bottom: -20px;
    }
    
    .hex-row:nth-child(3) {
        margin-top: -20px;
    }
    
    .hex-input {
        font-size: 1.6rem;
        width: 50px;
        height: 50px;
    }
    
    .words-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5rem;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 400px) {
    .hexagon {
        width: 60px;
        height: 69px;
    }
    
    .hex-row:nth-child(1) {
        margin-bottom: -16px;
    }
    
    .hex-row:nth-child(3) {
        margin-top: -16px;
    }
    
    .hex-input {
        font-size: 1.3rem;
        width: 40px;
        height: 40px;
    }
}
