/* Game-specific styles */

/* Game board */
#game-board {
    position: relative;
    width: 100%;
    height: 100%;
}

.cell {
    position: absolute;
    border: 2px solid var(--cell-border);
    background: var(--cell-background);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    user-select: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-light);
}

.cell:hover {
    background: var(--cell-hover);
    border-color: var(--primary-brand);
    z-index: 2;
    box-shadow: 0 2px 4px var(--shadow-medium);
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.cell.drop-zone-highlight {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(72, 219, 128, 0.1) 100%) !important;
    border: 2px solid #22c55e !important;
    z-index: 5 !important;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
}

.letter-cell {
    background: var(--letter-cell-bg);
    border: 2px solid var(--primary-brand);
    box-shadow: 0 2px 6px var(--shadow-medium);
    z-index: 3;
    border-radius: 8px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.letter-cell:hover {
    transform: scale(1.03) translateY(-1px);
    z-index: 5;
    box-shadow: 0 3px 8px var(--shadow-dark);
}

/* Show not-allowed cursor when dragging over occupied cells */
.letter-cell.drag-over {
    cursor: not-allowed !important;
    opacity: 0.8;
    transform: scale(1.01);
}

/* Staged letters */
.staged-letter {
    background: var(--staged-letter-bg) !important;
    border: 2px solid var(--staged-letter-border) !important;
    box-shadow: 0 2px 8px var(--shadow-medium) !important;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.staged-letter:hover {
    transform: scale(1.05) translateY(-1px);
    z-index: 5;
    box-shadow: 0 3px 10px var(--shadow-dark) !important;
}

/* Staged letters on multiplier cells - keep multiplier background with staged overlay */
.staged-letter.multiplier-2l {
    background: linear-gradient(135deg, 
        rgba(254, 243, 199, 0.9) 0%, 
        rgba(253, 230, 138, 0.9) 50%,
        rgba(219, 234, 254, 0.9) 100%) !important;
    border: 2px solid #f59e0b !important;
    box-shadow: 0 0 0 1px #3b82f6 inset, 0 2px 8px rgba(245, 158, 11, 0.25) !important;
}

.staged-letter.multiplier-3l {
    background: linear-gradient(135deg, 
        rgba(254, 243, 199, 0.9) 0%, 
        rgba(253, 230, 138, 0.9) 50%,
        rgba(220, 252, 231, 0.9) 100%) !important;
    border: 2px solid #f59e0b !important;
    box-shadow: 0 0 0 1px #22c55e inset, 0 2px 8px rgba(245, 158, 11, 0.25) !important;
}

.staged-letter.multiplier-2w {
    background: linear-gradient(135deg, 
        rgba(254, 243, 199, 0.9) 0%, 
        rgba(253, 230, 138, 0.9) 50%,
        rgba(254, 215, 170, 0.9) 100%) !important;
    border: 2px solid #f59e0b !important;
    box-shadow: 0 0 0 1px #f97316 inset, 0 2px 8px rgba(245, 158, 11, 0.25) !important;
}

.staged-letter.multiplier-3w {
    background: linear-gradient(135deg, 
        rgba(254, 243, 199, 0.9) 0%, 
        rgba(253, 230, 138, 0.9) 50%,
        rgba(254, 202, 202, 0.9) 100%) !important;
    border: 2px solid #f59e0b !important;
    box-shadow: 0 0 0 1px #ef4444 inset, 0 2px 8px rgba(245, 158, 11, 0.25) !important;
}

.staged-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 8px;
    color: #f59e0b;
    font-weight: bold;
}

.letter-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
}

.letter {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    text-shadow: 0 1px 2px var(--shadow-light);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-shadow: 0 1px 1px var(--shadow-light);
    position: absolute;
    bottom: 2px;
    right: 2px;
}

/* Multiplier Cells */
/* Multiplier cells should not have position: relative
   as they are already positioned absolutely by the grid system */
.multiplier-cell {
    /* Cell positioning is handled by the grid system */
}

.multiplier-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
}

.multiplier-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    font-weight: bold;
    padding: 1px 3px;
    border-radius: 2px;
    line-height: 1;
    z-index: 10;
    pointer-events: none;
}

/* Letter Multiplier Backgrounds */
.multiplier-2l {
    background: var(--multiplier-2l-bg) !important;
    border-color: var(--multiplier-2l-border) !important;
}

.multiplier-2l .multiplier-indicator {
    background: var(--multiplier-2l-indicator);
    color: white;
}

.multiplier-3l {
    background: var(--multiplier-3l-bg) !important;
    border-color: var(--multiplier-3l-border) !important;
}

.multiplier-3l .multiplier-indicator {
    background: var(--multiplier-3l-indicator);
    color: white;
}

.multiplier-5l {
    background: var(--multiplier-5l-bg) !important;
    border-color: var(--multiplier-5l-border) !important;
}

.multiplier-5l .multiplier-indicator {
    background: var(--multiplier-5l-indicator);
    color: white;
}

/* Word Multiplier Backgrounds */
.multiplier-2w {
    background: var(--multiplier-2w-bg) !important;
    border-color: var(--multiplier-2w-border) !important;
}

.multiplier-2w .multiplier-indicator {
    background: var(--multiplier-2w-indicator);
    color: white;
}

.multiplier-3w {
    background: var(--multiplier-3w-bg) !important;
    border-color: var(--multiplier-3w-border) !important;
}

.multiplier-3w .multiplier-indicator {
    background: var(--multiplier-3w-indicator);
    color: white;
}

.multiplier-5w {
    background: var(--multiplier-5w-bg) !important;
    border-color: var(--multiplier-5w-border) !important;
}

.multiplier-5w .multiplier-indicator {
    background: var(--multiplier-5w-indicator);
    color: white;
}

/* Letter drawer */
#letter-drawer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--background-surface);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 20px var(--shadow-medium);
    border: 2px solid var(--primary-brand);
    z-index: 1000;
    display: none;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

#drawer-slots {
    display: flex;
    gap: 8px;
}

.letter-slot {
    width: 55px;
    height: 55px;
    border: 2px dashed var(--border-medium);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.letter-slot:hover {
    border-color: var(--primary-brand);
}

.letter-item {
    width: 100%;
    height: 100%;
    background: var(--background-surface);
    color: var(--text-primary);
    border: 2px solid var(--border-light);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: 0 2px 4px var(--shadow-light);
}

.letter-item:active {
    cursor: grabbing;
}

.letter-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--shadow-medium);
    border-color: var(--primary-brand);
    background: var(--background-secondary);
}

.letter-item .letter {
    color: var(--text-primary) !important;
    font-size: 18px !important;
    font-weight: bold !important;
    position: static !important;
    transform: none !important;
    text-shadow: none !important;
}

.letter-item .value {
    color: var(--text-secondary) !important;
    font-size: 10px !important;
    margin-top: 1px;
    font-weight: 600 !important;
    position: static !important;
    transform: none !important;
}

/* Timer display for empty slots */
.timer-slot {
    border-color: var(--text-muted) !important;
    background: var(--background-secondary);
}

.timer-display {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.timer-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

/* Location overlay */
#location-overlay {
    position: fixed;
    top: 80px;
    left: 20px;
    background: #ffffff;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 4px solid #3b82f6;
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 180px;
}

[data-theme="dark"] #location-overlay {
    background: #1e293b;
    border-color: #60a5fa;
}

.location-info {
    display: flex;
    justify-content: center;
    align-items: center;
}

.coordinates {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--text-primary);
    font-size: 16px;
    text-align: center;
}

.goto-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.goto-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

/* Minimap container and styles */
.minimap-container {
    position: relative;
    width: 150px;
    height: 150px;
    border: 4px solid #3b82f6;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .minimap-container {
    background: #0f172a;
    border-color: #60a5fa;
}

.minimap-container:hover {
    border-color: #2563eb;
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

#minimap-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

#minimap-position-marker {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ff0000;
    border: 2px solid #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.minimap-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    padding: 10px;
}

/* Out of bounds indicator */
.minimap-container.out-of-bounds::after {
    content: "Current position\noutside map area";
    position: absolute;
    bottom: 5px;
    left: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    text-align: center;
    white-space: pre-line;
    z-index: 15;
}

/* Loading state for minimap */
.minimap-container.loading {
    opacity: 0.7;
}

.minimap-container.loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-light);
    border-top: 2px solid var(--primary-brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 20;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Feedback message for minimap */
.minimap-feedback {
    position: absolute;
    bottom: 5px;
    left: 5px;
    right: 5px;
    background: rgba(34, 197, 94, 0.9);
    color: white;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 3px;
    text-align: center;
    z-index: 15;
    display: none;
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(10px); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-5px); }
}

/* Drag and drop feedback */
.cell.drag-over {
    background: rgba(249, 60, 18, 0.2) !important;
    border-color: #f93c12 !important;
    transform: scale(1.02);
}

.letter-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

/* Responsive design */
@media (max-width: 768px) {
    #letter-drawer {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        padding: 10px;
    }
    
    #drawer-slots {
        gap: 6px;
        justify-content: center;
    }
    
    .letter-slot {
        width: 45px;
        height: 45px;
    }
    
    #location-overlay {
        top: 70px;
        left: 10px;
        padding: 8px 12px;
    }
    
    .coordinates {
        font-size: 12px;
    }
}

/* Action buttons for staged letters */
.drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px;
    background: #fef3c7;
    border-radius: 8px;
    border: 2px solid #f59e0b;
}

/* Powerups section */
.drawer-powerups {
    margin-bottom: 8px;
    padding: 8px 4px;
    background: transparent;
}

.powerup-icons {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.powerup-item {
    position: relative;
    width: 42px;
    height: 42px;
    background: #dbeafe;
    border: 2px solid #60a5fa;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.powerup-item:hover:not(.disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #bfdbfe;
    border-color: #3b82f6;
}

.powerup-item:active:not(.disabled) {
    transform: translateY(-1px) scale(0.98);
}

.powerup-item.disabled {
    background: #e5e7eb;
    border-color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.5;
}

.powerup-icon {
    font-size: 20px;
    line-height: 1;
}

.powerup-cost {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: #fbbf24;
    color: #78350f;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 10px;
    border: 2px solid #f59e0b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.powerup-item.disabled .powerup-cost {
    background: #d1d5db;
    color: #6b7280;
    border-color: #9ca3af;
}

[data-theme="dark"] .powerup-item {
    background: #1e3a8a;
    border-color: #3b82f6;
}

[data-theme="dark"] .powerup-item:hover:not(.disabled) {
    background: #1e40af;
    border-color: #60a5fa;
}

[data-theme="dark"] .powerup-item.disabled {
    background: #374151;
    border-color: #4b5563;
}

.action-info {
    text-align: center;
    color: #92400e;
    font-size: 12px;
    font-weight: 600;
}

.staged-count {
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #d97706;
    font-weight: 700;
    color: #92400e;
    font-size: 11px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.submit-btn {
    background: #10b981;
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.submit-btn:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

.submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.clear-btn {
    background: #ef4444;
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.clear-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
}

/* Mobile responsive for action buttons */
@media (max-width: 768px) {
    .action-buttons {
        gap: 8px;
    }
    
    .action-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .staged-count {
        padding: 4px 10px;
        font-size: 12px;
    }
}