/* Prize Grid Game - Modern Minimalist CSS */

:root {
    /* Color Palette */
    --primary-color: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #059669;
    --warning-color: #d97706;
    --error-color: #dc2626;
    
    /* Surface Colors */
    --surface-color: #ffffff;
    --surface-secondary: #f8fafc;
    --surface-tertiary: #f1f5f9;
    
    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
}

/* RTL Support for Arabic */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
    font-family: 'Segoe UI', 'Tahoma', 'Arial', 'Helvetica', sans-serif;
}

[dir="rtl"] .prize-grid-game-container {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', 'Helvetica', sans-serif;
}

[dir="rtl"] .rolls-counter::before {
    margin-left: var(--space-2);
    margin-right: 0;
}

[dir="rtl"] .points-counter::before {
    margin-left: var(--space-2);
    margin-right: 0;
}

[dir="rtl"] .prize-grid-controls {
    text-align: center;
}

[dir="rtl"] .user-winning-history {
    text-align: right;
}

[dir="rtl"] .history-prize-info {
    text-align: right;
}

[dir="rtl"] .result-content {
    text-align: center;
}

[dir="rtl"] .close-result {
    margin-left: 0;
    margin-right: auto;
}

/* Additional RTL Support */
[dir="rtl"] .prize-grid-game-container {
    direction: rtl;
    text-align: right;
    font-family: 'Segoe UI', 'Tahoma', 'Arial', 'Helvetica', sans-serif;
}

[dir="rtl"] .prize-grid-header {
    text-align: center;
}

[dir="rtl"] .game-stats {
    flex-direction: row-reverse;
}

[dir="rtl"] .rolls-counter,
[dir="rtl"] .points-counter {
    flex-direction: row-reverse;
}

[dir="rtl"] .prize-grid-controls {
    text-align: center;
}

[dir="rtl"] .user-winning-history {
    text-align: right;
}

[dir="rtl"] .history-prize-info {
    text-align: right;
}

[dir="rtl"] .result-content {
    text-align: center;
}

[dir="rtl"] .winner-text {
    text-align: center;
}

[dir="rtl"] .reset-info {
    text-align: center;
}

/* RTL Mobile Support */
@media (max-width: 768px) {
    [dir="rtl"] .game-stats {
        flex-direction: column;
        align-items: center;
    }
    
    [dir="rtl"] .rolls-counter,
    [dir="rtl"] .points-counter {
        flex-direction: row-reverse;
    }
}

@media (max-width: 480px) {
    [dir="rtl"] .game-stats {
        flex-direction: column;
        align-items: center;
    }
    
    [dir="rtl"] .rolls-counter,
    [dir="rtl"] .points-counter {
        flex-direction: row-reverse;
    }
}

/* Base Styles */
.prize-grid-game-container {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', 'Helvetica', sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    padding: var(--space-6);
    color: var(--text-primary);
}

.prize-grid-game {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.8);
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
}

/* Clean Minimalist Header */
.prize-grid-header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--surface-tertiary);
    padding: var(--space-4) var(--space-6);
    text-align: center;
    color: var(--text-primary);
}

.prize-grid-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 var(--space-2) 0;
    color: var(--text-primary);
}

.prize-grid-header p {
    font-size: 0.875rem;
    margin: 0 0 var(--space-4) 0;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Game Header Indicators */
.prize-grid-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    text-align: center;
    padding: var(--space-6) var(--space-4);
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-6);
}

.prize-grid-header h2 {
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.prize-grid-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
    line-height: 1.5;
    max-width: 500px;
}

/* Game Stats Container */
.game-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-2);
}

.reset-info {
    text-align: center;
    margin-top: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--surface-tertiary);
    transition: all 0.3s ease;
}

.reset-info:hover {
    background: var(--surface-tertiary);
    border-color: var(--primary-color);
}

.reset-info small {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
    display: block;
    line-height: 1.4;
}

.reset-info small.reset-complete {
    color: var(--success-color);
    font-weight: 600;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Clean Rolls Counter */
.rolls-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    background: var(--surface-color);
    border: 2px solid var(--surface-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    font-size: 1rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    min-width: 120px;
}

.rolls-counter:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.rolls-counter::before {
    content: '🎲';
    font-size: 1.125rem;
    line-height: 1;
}

.rolls-text {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

.no-rolls {
    color: var(--error-color);
    font-weight: 600;
}

/* Points Counter */
.points-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    background: var(--surface-color);
    border: 2px solid var(--surface-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    font-size: 1rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    min-width: 120px;
}

.points-counter:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.points-counter::before {
    content: var(--points-emoji, '💰');
    font-size: 1.125rem;
    line-height: 1;
}

.points-text {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

/* Prize Grid */
.prize-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    padding: var(--space-6);
    background: var(--surface-secondary);
}

/* Optimized Prize Items - Image Only */
.prize-item {
    background: var(--surface-color);
    border: 2px solid var(--surface-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.prize-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.prize-item:hover::before {
    opacity: 1;
}

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

/* Prize Image Container */
.prize-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    position: relative;
}

.prize-image img {
    max-width: 100%;
    max-height: 80px;
    width: auto;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    object-fit: contain;
}

/* Prize Placeholder */
.prize-placeholder {
    background: linear-gradient(135deg, var(--surface-tertiary) 0%, var(--surface-secondary) 100%);
    border: 2px dashed var(--text-muted);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: var(--space-3);
    text-align: center;
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

/* Remove prize name display */
.prize-name {
    display: none;
}

/* Controls Section */
.prize-grid-controls {
    background: var(--surface-color);
    border-top: 1px solid var(--surface-tertiary);
    padding: var(--space-6);
    text-align: center;
}

.roll-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: var(--space-4) var(--space-8);
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-width: 200px;
}

.roll-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.roll-button:hover::before {
    left: 100%;
}

.roll-button:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.roll-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.roll-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.roll-button:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Result Modal */
.prize-result {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.result-content {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.8);
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: slideIn 0.3s ease;
}

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

.result-content h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 var(--space-6) 0;
}

#result-prize {
    background: linear-gradient(135deg, var(--surface-secondary) 0%, var(--surface-tertiary) 100%);
    border: 1px solid var(--surface-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin: var(--space-4) 0;
}

#result-prize h4 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 var(--space-4) 0;
}

#result-prize img {
    max-width: 100%;
    max-height: 150px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin: 0 auto;
    display: block;
}

.result-stats {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-left: 4px solid var(--primary-dark);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin: var(--space-4) 0;
}

.result-stats p {
    color: white;
    margin: 0;
    font-weight: 500;
}

.close-result {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: var(--space-3) var(--space-6);
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: var(--space-4);
}

.close-result:hover {
    background: var(--text-secondary);
    transform: translateY(-1px);
}

/* User Winning History */
.user-winning-history {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.8);
    margin-top: var(--space-6);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.user-winning-history h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 var(--space-4) 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.user-winning-history h3::before {
    content: '📋';
    font-size: 1rem;
}

.user-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.user-history-list li {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--surface-tertiary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.user-history-list li:last-child {
    border-bottom: none;
}

.history-prize-image {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-prize-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-prize-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.history-prize-info strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.history-points {
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 600;
}

.history-date {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 400;
}

/* Game Disabled State */
.prize-grid-game-disabled {
    background: var(--surface-color);
    border: 1px solid var(--error-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
    box-shadow: var(--shadow-md);
}

.prize-grid-game-disabled p {
    color: var(--error-color);
    margin: 0;
    font-weight: 500;
}

/* Animation States */
.prize-item.rolling {
    transition: all 0.1s ease-out;
}

.prize-item.highlight {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: var(--primary-color);
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.2);
    transition: all 0.1s ease-out;
}

.prize-item.winning {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: var(--success-color);
    box-shadow: 0 0 20px rgba(5, 150, 105, 0.3);
    transform: scale(1.02);
}

.prize-item.winner-pulse {
    animation: winner-pulse 0.8s ease-in-out infinite;
}

@keyframes winner-pulse {
    0% { 
        transform: scale(1.02);
        box-shadow: 0 0 20px rgba(5, 150, 105, 0.2);
    }
    100% { 
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(5, 150, 105, 0.4);
    }
}

.winner-text {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--success-color);
    font-weight: 600;
    font-size: 0.875rem;
    background: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--success-color);
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

/* Confetti Animation */
.confetti-piece {
    animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 0.8;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Error Messages */
.game-error {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--error-color);
    color: white;
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    display: none;
    font-weight: 500;
    max-width: 300px;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.spin {
    animation: spin 1s linear infinite;
}

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

/* Focus States for Accessibility */
.roll-button:focus,
.close-result:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

/* Print Styles */
@media print {
    .prize-grid-game-container {
        background: white;
        padding: 0;
    }
    
    .prize-grid-game {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .roll-button,
    .close-result {
        display: none;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .prize-grid-game-container {
        padding: var(--space-4);
    }
    
    .prize-grid-header {
        padding: var(--space-4) var(--space-3);
        gap: var(--space-3);
    }
    
    .prize-grid-header h2 {
        font-size: 1.5rem;
    }
    
    .prize-grid-header p {
        font-size: 0.875rem;
    }
    
    .game-stats {
        gap: var(--space-2);
        flex-direction: column;
        align-items: center;
    }
    
    .reset-info small {
        font-size: 0.7rem;
    }
    
    .rolls-counter,
    .points-counter {
        font-size: 0.875rem;
        padding: var(--space-2) var(--space-3);
        min-width: 100px;
    }
    
    .rolls-counter::before,
    .points-counter::before {
        font-size: 1rem;
    }
    
    .rolls-text,
    .points-text {
        font-size: 0.875rem;
    }
    
    .prize-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-2);
        padding: var(--space-4);
    }
    
    .prize-item {
        min-height: 80px;
        padding: var(--space-2);
    }
    
    .prize-image img {
        max-height: 50px;
    }
    
    .prize-placeholder {
        height: 50px;
        font-size: 0.6rem;
        padding: var(--space-2);
    }
    
    .roll-button {
        padding: var(--space-3) var(--space-6);
        font-size: 1rem;
        min-width: 160px;
    }
    
    .result-content {
        padding: var(--space-6);
        margin: var(--space-4);
    }
    
    .user-winning-history {
        padding: var(--space-4);
        margin-top: var(--space-4);
    }
}

@media (max-width: 480px) {
    .prize-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-2);
        padding: var(--space-3);
    }
    
    .prize-item {
        min-height: 70px;
        padding: var(--space-2);
    }
    
    .prize-image img {
        max-height: 40px;
    }
    
    .prize-placeholder {
        height: 40px;
        font-size: 0.5rem;
        padding: var(--space-1);
    }
    
    .prize-grid-header h2 {
        font-size: 1.25rem;
    }
    
    .prize-grid-header p {
        font-size: 0.8rem;
    }
    
    .game-stats {
        flex-direction: column;
        gap: var(--space-2);
        justify-content: center;
        align-items: center;
    }
    
    .reset-info small {
        font-size: 0.65rem;
    }
    
    .rolls-counter,
    .points-counter {
        font-size: 0.75rem;
        padding: var(--space-2) var(--space-3);
        min-width: 80px;
        justify-content: center;
        align-items: center;
    }
    
    .rolls-counter::before,
    .points-counter::before {
        font-size: 0.875rem;
    }
    
    .rolls-text,
    .points-text {
        font-size: 0.75rem;
    }
    
    .roll-button {
        padding: var(--space-2) var(--space-4);
        font-size: 0.9rem;
        min-width: 140px;
    }
} 