/* Tile Slider Game - Custom Styles */

/* Puzzle tile styles */
.puzzle-tile {
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.puzzle-tile:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.number-tile:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.empty-tile {
    background: linear-gradient(45deg, #f8f9fa 25%, transparent 25%),
        linear-gradient(-45deg, #f8f9fa 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f8f9fa 75%),
        linear-gradient(-45deg, transparent 75%, #f8f9fa 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}

/* Puzzle preview styles */
.puzzle-preview {
    max-width: 120px;
    margin: 0 auto;
}

.tile-preview {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 4px;
}

/* Game interface enhancements */
.puzzle-grid {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Card hover effects */
.puzzle-card {
    transition: all 0.3s ease;
}

.puzzle-card:hover {
    transform: translateY(-5px);
}

/* Button enhancements */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Navigation enhancements */
.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover {
    color: #fff !important;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Alert enhancements */
.alert {
    border-radius: 10px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Modal enhancements */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-radius: 15px 15px 0 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .puzzle-grid {
        padding: 4px;
    }

    .tile-preview {
        font-size: 0.6rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    .display-6 {
        font-size: 2rem;
    }

    .h4 {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .puzzle-grid {
        padding: 2px;
    }

    .tile-preview {
        font-size: 0.5rem;
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    .display-6 {
        font-size: 1.5rem;
    }

    .h4 {
        font-size: 1.25rem;
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Success animation */
.success-bounce {
    animation: successBounce 0.6s ease-in-out;
}

@keyframes successBounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* Tile movement animation */
.tile-moving {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

/* Randomization animation */
.tile-randomizing {
    transition: all 0.04s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.tile-randomizing.number-tile {
    background-color: #28a745 !important;
    border-color: #1e7e34 !important;
}

/* Puzzle container during randomization */
.puzzle-randomizing {
    pointer-events: none;
    opacity: 0.9;
}

/* Randomization progress indicator */
.randomization-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    z-index: 1000;
    display: none;
}

/* Fade in animation for tiles */
.tile-fade-in {
    animation: tileFadeIn 0.2s ease-in;
}

@keyframes tileFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide animation for tile movements */
.tile-slide {
    animation: tileSlide 0.04s ease-out;
}

@keyframes tileSlide {
    from {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    to {
        transform: scale(1);
    }
}

/* Focus styles for accessibility */
.btn:focus,
.nav-link:focus {
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Best Times Horizontal Layout */
.best-time-item {
    float: left;
    width: 150px;
    margin-right: 15px;
    margin-bottom: 15px;
}

.best-time-item .card {
    height: 120px;
    display: flex;
    align-items: center;
}

.best-time-item .card-body {
    padding: 15px;
    width: 100%;
}

/* Clear float after best times */
#personal-best-times::after {
    content: "";
    display: table;
    clear: both;
}

/* Responsive design for best times */
@media (max-width: 768px) {
    .best-time-item {
        width: 140px;
        margin-right: 10px;
    }
}

/* Dashboard specific styles */
.dashboard-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

.achievement-card {
    transition: all 0.3s ease;
}

.achievement-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3) !important;
}

.quick-action-btn {
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Dashboard stats animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-stat {
    animation: countUp 0.6s ease-out;
}

/* Responsive dashboard */
@media (max-width: 768px) {
    .dashboard-card .card-body {
        padding: 1rem;
    }

    .quick-action-btn {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    .bg-light {
        background-color: #343a40 !important;
        color: #f8f9fa !important;
    }

    .text-muted {
        color: #adb5bd !important;
    }
}