/**
 * Snake 3D Projects Styles
 * Styling for the interactive 3D Snake game project gallery
 */

/* Snake Canvas Container */
#snake-canvas {
    position: relative;
    width: 100%;
    height: 700px;
    background: linear-gradient(135deg, #f5f5f7 0%, #ffffff 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    display: none; /* Hidden by default */
    touch-action: none; /* Prevent default touch behaviors */
}

/* Responsive height for mobile */
@media (max-width: 768px) {
    #snake-canvas {
        height: 500px;
    }
}

#snake-canvas.active {
    display: block;
}

#snake-canvas canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Toggle Button */
.view-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding: 12px 20px;
    background: var(--light-bg-secondary);
    border-radius: 980px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    transition: all 0.3s ease;
    position: relative;
}

.view-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.2);
}

.view-toggle-label {
    font-size: 14px;
    color: var(--gray-text);
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 32px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(28px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.5);
}

.view-mode-text {
    font-size: 14px;
    color: var(--dark-text);
    font-weight: 600;
    min-width: 80px;
    text-align: center;
    transition: all 0.3s ease;
}

/* Snake 3D text styling */
.view-mode-text:last-of-type {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    position: relative;
    animation: snake-pulse 2s ease-in-out infinite;
}

@keyframes snake-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Enhanced styling when Snake mode is active */
.toggle-switch input:checked ~ .view-toggle {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
}


/* Snake UI Elements */
.snake-ui-element {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

#snake-score {
    top: 20px;
    left: 20px;
}

.score-label {
    font-size: 12px;
    color: var(--gray-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.score-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-text);
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#snake-instructions {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    transition: opacity 0.3s ease;
}

.instructions-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 8px;
}

.instructions-hint {
    font-size: 14px;
    color: var(--gray-text);
}

/* Reset Button */
.snake-reset-button {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid var(--light-border);
    border-radius: 980px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-text);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.snake-reset-button:hover {
    background: var(--dark-text);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Project Popup */
.project-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.project-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.popup-content {
    position: relative;
}

.popup-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 32px;
    height: 32px;
    background: var(--dark-text);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.popup-close:hover {
    transform: scale(1.1) rotate(90deg);
}

.popup-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-text);
    margin-bottom: 12px;
    line-height: 1.3;
}

.popup-description {
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-text);
    margin-bottom: 20px;
}

.popup-techs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.popup-techs .tech-tag {
    padding: 6px 12px;
    background: var(--light-bg-secondary);
    border-radius: 980px;
    font-size: 12px;
    font-weight: 600;
    color: var(--dark-text);
    border: 1px solid var(--light-border);
}

.popup-category {
    padding-top: 16px;
    border-top: 1px solid var(--light-border);
    margin-bottom: 12px;
}

.popup-footer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--light-border);
}

.popup-hint {
    font-size: 13px;
    color: var(--gray-text);
    font-style: italic;
    opacity: 0.8;
}

.popup-ok-button {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 12px 24px;
    background: #1d1d1f;
    color: #ffffff;
    border: none;
    border-radius: 980px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.popup-ok-button:hover {
    background: #000000;
    transform: scale(1.02);
}

.popup-ok-button:active {
    transform: scale(0.98);
}

.category-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 980px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
}

.category-badge[data-category="ai"] {
    background: linear-gradient(135deg, #9333ea, #7c3aed);
}

.category-badge[data-category="laravel"] {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.category-badge[data-category="react"] {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.category-badge[data-category="python"] {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.category-badge[data-category="devops"] {
    background: linear-gradient(135deg, #10b981, #059669);
}

.category-badge[data-category="javascript"] {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* Pause Indicator */
.pause-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 5;
}

.pause-indicator.active {
    opacity: 1;
    visibility: visible;
}

.pause-indicator span {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.pause-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.pause-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.pause-hint {
    font-size: 14px;
    font-weight: 400;
    opacity: 0.8;
    letter-spacing: 0.05em;
}

.resume-button {
    margin-top: 16px;
    padding: 12px 32px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 980px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.resume-button:hover {
    background: #059669;
    transform: scale(1.05);
}

.resume-button:active {
    transform: scale(0.98);
}

/* Win Message */
.win-message {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(245, 245, 247, 0.98));
}

.win-message h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark-text);
    margin-bottom: 16px;
}

.win-message p {
    font-size: 18px;
    color: var(--gray-text);
    margin-bottom: 24px;
}

.play-again-button {
    padding: 12px 32px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 980px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.play-again-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    #snake-canvas {
        height: 500px;
    }

    .view-toggle {
        padding: 10px 16px;
        gap: 10px;
    }

    .toggle-switch {
        width: 50px;
        height: 28px;
    }

    .toggle-slider:before {
        height: 22px;
        width: 22px;
    }

    .toggle-switch input:checked + .toggle-slider:before {
        transform: translateX(22px);
    }

    .snake-ui-element {
        padding: 12px 16px;
    }

    #snake-score {
        top: 10px;
        left: 10px;
    }

    .score-value {
        font-size: 20px;
    }

    #snake-instructions {
        top: auto;
        bottom: 10px;
        padding: 12px 20px;
    }

    .instructions-text {
        font-size: 14px;
    }

    .instructions-hint {
        font-size: 12px;
    }

    .project-popup {
        padding: 24px;
        width: 95%;
    }

    .popup-title {
        font-size: 20px;
    }

    .popup-description {
        font-size: 14px;
    }

    .win-message {
        padding: 32px;
    }

    .win-message h2 {
        font-size: 24px;
    }

    .win-message p {
        font-size: 16px;
    }
}

/* Smooth transitions for view switching */
.projects-section {
    transition: opacity 0.3s ease;
}

.projects-section.switching {
    opacity: 0;
}

/* Loading state */
.snake-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: var(--gray-text);
}

.snake-loading:after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 3px solid var(--light-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Accessibility - Focus States */
.snake-reset-button:focus,
.popup-close:focus,
.play-again-button:focus,
.toggle-switch input:focus + .toggle-slider {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .snake-ui-element {
        border: 2px solid var(--dark-text);
    }

    .project-popup {
        border: 2px solid var(--dark-text);
    }
}

/* Mobile Swipe Hint */
.mobile-swipe-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    z-index: 15;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 12px 24px;
    border-radius: 980px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    .mobile-swipe-hint {
        display: block;
    }
}

.swipe-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark-text);
}

.swipe-indicator svg {
    opacity: 0.8;
    animation: pulse 2s ease-in-out infinite;
}

.swipe-indicator span {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-text);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* Hide swipe hint on desktop */
@media (min-width: 769px) {
    .mobile-swipe-hint {
        display: none !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .project-popup,
    .snake-reset-button,
    .popup-close,
    .play-again-button,
    .toggle-slider,
    .toggle-slider:before,
    .mobile-swipe-hint,
    .swipe-indicator svg {
        transition-duration: 0.01ms !important;
        animation: none !important;
    }
}