/**
 * Tetris Corner Pro Styles - v1.0.0
 * Unique namespace: tetriscp-
 */

/* Fixed Tetris Button - Top Right Corner */
#tetriscp-btn {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 2147483647 !important;
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

#tetriscp-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

#tetriscp-btn:active {
    transform: translateY(0);
}

#tetriscp-btn .tetriscp-icon {
    font-size: 18px;
}

#tetriscp-btn .tetriscp-text {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modal Overlay - HIDDEN BY DEFAULT */
#tetriscp-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2147483646 !important;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Modal Active State */
#tetriscp-modal.tetriscp-active {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center;
    justify-content: center;
}

/* Modal Backdrop */
#tetriscp-backdrop {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(4px);
    cursor: pointer;
}

/* Modal Content Container */
#tetriscp-content {
    position: relative !important;
    background: #1a1a2e;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 2147483647;
}

/* Modal Header */
#tetriscp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
}

#tetriscp-header h2 {
    margin: 0;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 20px;
    font-weight: 600;
}

/* Close Button */
#tetriscp-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(231, 76, 60, 0.8);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

#tetriscp-close:hover {
    background: rgba(231, 76, 60, 1);
    transform: rotate(90deg);
}

#tetriscp-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Modal Body */
#tetriscp-body {
    padding: 24px;
    overflow: auto;
}

/* Game Container */
.tetriscp-container {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* Main Canvas */
#tetriscp-canvas {
    background: #0f0f23;
    border: 2px solid #0f3460;
    border-radius: 8px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Sidebar */
.tetriscp-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 140px;
}

/* Next Piece */
.tetriscp-next {
    background: #16213e;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.tetriscp-next h3 {
    margin: 0 0 12px 0;
    color: #fff;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#tetriscp-next-canvas {
    background: #0f0f23;
    border-radius: 4px;
}

/* Stats */
.tetriscp-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tetriscp-stat {
    display: flex;
    flex-direction: column;
    background: #16213e;
    padding: 12px 16px;
    border-radius: 8px;
}

.tetriscp-stat-label {
    color: #8892b0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.tetriscp-stat-value {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* Controls Info */
.tetriscp-controls {
    background: #16213e;
    padding: 16px;
    border-radius: 8px;
}

.tetriscp-controls h3 {
    margin: 0 0 12px 0;
    color: #fff;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tetriscp-controls p {
    margin: 6px 0;
    color: #8892b0;
    font-size: 12px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #tetriscp-btn {
        padding: 10px 16px;
        font-size: 12px;
        top: 10px !important;
        right: 10px !important;
    }
    
    #tetriscp-btn .tetriscp-text {
        display: none;
    }
    
    #tetriscp-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .tetriscp-container {
        flex-direction: column;
        align-items: center;
    }
    
    .tetriscp-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    
    .tetriscp-next,
    .tetriscp-stats,
    .tetriscp-controls {
        flex: 1;
        min-width: 100px;
    }
    
    #tetriscp-body {
        padding: 16px;
    }
    
    #tetriscp-canvas {
        width: 100%;
        max-width: 300px;
        height: auto;
    }
}

/* Animation for modal */
@keyframes tetriscpFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes tetriscpSlideIn {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

#tetriscp-modal.tetriscp-active {
    animation: tetriscpFadeIn 0.2s ease;
}

#tetriscp-modal.tetriscp-active #tetriscp-content {
    animation: tetriscpSlideIn 0.3s ease;
}