:root {
    --bg-color: #0d1117;
    --card-bg: #161b22;
    --text-color: #c9d1d9;
    --accent-color: #58a6ff;
    --hover-color: #1f6feb;
    --success-color: #238636;
    --border-color: #30363d;
}

body {
    background-color: var(--bg-color);
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    color: var(--text-color);
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-weight: 300;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}

/* Global Scrollbar Styling */
* {
    box-sizing: border-box;
    /* Critical for responsive padding */
    scrollbar-width: thin;
    scrollbar-color: #8b949e #0d1117;
    /* High contrast thumb for Firefox */
}

/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: #0d1117;
}

*::-webkit-scrollbar-thumb {
    background: #8b949e;
    /* Light grey thumb */
    border-radius: 10px;
}

*::-webkit-scrollbar-thumb:hover {
    background: white;
    /* Bright white on hover */
}

/* Only show scrollbar when needed */
html {
    overflow-y: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 40px;
    width: 100%;
}

/* Specific alignment for frontend index to match grid */
body:not(.admin-page) header {
    max-width: 990px;
    margin-left: auto;
    margin-right: auto;
    justify-content: flex-start;
}

@media (max-width: 1024px) {
    header {
        max-width: 650px;
        /* 2 cards * 310 + 30 gap */
    }
}

@media (max-width: 768px) {
    header {
        max-width: 100%;
        padding: 0 20px;
        justify-content: center;
    }
}

.logo {
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 310px);
    justify-content: center;
    gap: 30px;
}

.product-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

/* Tablet: 2 cards per row */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(2, 310px);
        gap: 20px;
    }
}

/* Mobile: 1 card per row */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: 1fr;
        padding: 0 10px;
    }
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7), 0 0 20px var(--shadow-glow);
    border-color: var(--accent-color);
}

.product-image {
    width: 100%;
    height: 200px;
    background: #21262d;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8b949e;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 24px;
    flex-grow: 1;
}

.product-date {
    font-size: 14px;
    color: #8b949e;
    margin-bottom: 8px;
}

.product-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #f0f6fc;
}

.product-description {
    font-size: 14px;
    line-height: 1.5;
    color: #8b949e;
    margin-bottom: 20px;
}

.product-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent-color);
}

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.3s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    /* Force Font */
    /* Prevent ugly wrapping */
    /* Clean Styling Fixes */
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    cursor: pointer !important;
}

.btn-download {
    background-color: var(--success-color);
    color: white;
}

.btn-download:hover {
    background-color: #2ea043;
}

.btn-buy {
    background-color: #1f6feb;
    color: white;
}

.btn-buy:hover {
    background-color: #1a5cd7;
}

/* Cart icon - white color */
.btn-buy svg,
.btn-buy path {
    fill: white !important;
    stroke: white !important;
}

.version-item {
    background: var(--card-bg);
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.fix-item {
    padding: 8px;
    font-size: 14px;
    color: #8b949e;
    border-left: 2px solid var(--accent-color);
    margin-bottom: 10px;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
}

/* Modal Content with Jelly Animation */
.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.8), 0 0 30px var(--shadow-glow);
    display: flex;
    flex-direction: column;
}

.modal-content.animate-jelly {
    animation: jelly 0.6s ease-in-out both;
}

@keyframes jelly {
    0% {
        transform: scale(0.5, 0.5);
    }

    30% {
        transform: scale(1.1, 0.9);
    }

    40% {
        transform: scale(0.95, 1.05);
    }

    50% {
        transform: scale(1.05, 0.95);
    }

    65% {
        transform: scale(0.98, 1.02);
    }

    75% {
        transform: scale(1.02, 0.98);
    }

    100% {
        transform: scale(1, 1);
    }
}

.modal-header {
    padding: 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 100;
}

.modal-close,
.square-icon-btn {
    background: #21262d;
    border: 1px solid var(--border-color);
    color: white;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 6px;
    font-size: 14px;
}

.modal-close:hover,
.square-icon-btn:hover {
    color: white;
    border-color: var(--accent-color);
    background: #30363d;
    transform: scale(1.05);
}

.modal-header-actions {
    display: flex;
    gap: 8px;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* Share buttons */
.share-bar {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-share {
    background: #21262d;
    border: 1px solid var(--border-color);
    color: white;
    font-size: 13px;
    padding: 8px 15px;
}

.btn-share:hover {
    background: #30363d;
}

/* Product Header Background */
.product-header-bg {
    margin: -30px -30px 30px -30px;
    height: 200px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px 12px 0 0;
}

@media (max-width: 768px) {
    .product-header-bg {
        margin: -20px -20px 20px -20px;
        height: 150px;
    }
}

/* Gallery Slider - Steam Style */
.product-gallery {
    margin: 20px 0;
    background: #161b22;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.gallery-main {
    position: relative;
    width: 100%;
    height: 400px;
    background: #0d1117;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-main img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

.gallery-main video,
.gallery-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

.gallery-nav:hover {
    background: rgba(0, 0, 0, 0.9);
}

.gallery-nav.prev {
    left: 10px;
}

.gallery-nav.next {
    right: 10px;
}

.gallery-thumbnails {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: #0d1117;
    overflow-x: auto;
}

.gallery-thumb {
    flex: 0 0 100px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
    background: #161b22;
}

.gallery-thumb:hover {
    transform: scale(1.05);
    border-color: var(--accent-color);
}

.gallery-thumb.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.5);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumb video,
.thumb-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.gallery-thumb .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.gallery-thumb {
    position: relative;
}

/* Lightbox - Enhanced with Navigation */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    cursor: zoom-out;
}

.lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    animation: zoomIn 0.3s ease-out;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 100000;
}

.lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 100000;
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: #f85149;
    transform: scale(1.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .gallery-main {
        height: 250px;
    }

    .gallery-nav {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }

    .gallery-thumb {
        flex: 0 0 80px;
        height: 50px;
    }

    .lightbox-nav,
    .lightbox-close {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .lightbox-nav.prev {
        left: 10px;
    }

    .lightbox-nav.next {
        right: 10px;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
    }
}

/* Force vertical layout and padding fix for mobile */
@media (max-width: 768px) {

    .main-download-card>div,
    .version-item>div {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .main-download-card>div>div:last-child,
    .version-item>div>div:last-child {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .btn {
        min-width: 120px;
        justify-content: center;
    }

    /* Reduce modal padding on mobile */
    .modal-body {
        padding: 15px !important;
    }

    .modal-header {
        padding: 15px !important;
    }

    /* FORCE TEXT WRAPPING FOR EVERYTHING */
    .modal-body * {
        word-break: break-word;
        overflow-wrap: anywhere;
        max-width: 100%;
    }

    .version-item,
    .main-download-card {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: #161b22;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    max-width: 350px;
    animation: toastSlideIn 0.3s ease-out forwards;
    pointer-events: auto;
    border-left: 4px solid var(--accent-color);
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: #f85149;
}

.toast-icon {
    font-size: 18px;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: #f85149;
}

.toast-content {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.toast.hiding {
    animation: toastFadeOut 0.3s ease-in forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* PC Specific Fix: Force Horizontal Layout */
@media (min-width: 769px) {

    .main-download-card>div,
    .version-item>div {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .main-download-card>div>div:last-child,
    .version-item>div>div:last-child {
        width: auto !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
        border-top: none !important;
    }

    /* PC Compact Styling: 20% Size Reduction Area - Grid handles sizing now */

    .product-image {
        height: 140px;
        /* Reduced from 200px -> 160px -> 140px */
    }

    .product-info {
        padding: 15px;
        /* Reduced padding */
    }

    .product-title {
        font-size: 18px;
        /* Smaller title */
        margin-bottom: 8px;
    }

    .product-description {
        font-size: 13px;
        margin-bottom: 15px;
        line-height: 1.4;
    }

    .product-footer {
        padding: 12px 15px;
    }

    .price {
        font-size: 16px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    /* Move Logo Down slightly on PC */
    .logo {
        margin-top: 15px;
        position: relative;
        top: 5px;
        /* Fine-tune positioning */
    }
}

@media (max-width: 768px) {
    header {
        padding-bottom: 20px !important;
        margin-bottom: 20px !important;
    }
}

/* Accordion & Fix Row Mobile Refinements */
@media (max-width: 600px) {
    .accordion-header {
        padding: 8px 15px !important;
        height: auto !important;
        min-height: 40px;
    }

    .accordion-header span:first-child {
        font-size: 14px !important;
    }

    .accordion-content div {
        padding: 12px 15px !important;
        font-size: 13px !important;
    }

    .fix-item-row {
        padding: 15px !important;
        min-height: auto !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .fix-item-row>div:first-child {
        min-width: 100% !important;
        margin-bottom: 10px !important;
    }

    .fix-item-row>div:last-child {
        width: 100% !important;
        justify-content: space-between !important;
        display: flex !important;
        padding-top: 10px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    }

    .fix-item-row strong {
        font-size: 14px !important;
    }
}

/* Mobile Layout Adjustments: Reduce Header Spacing */
@media (max-width: 768px) {
    header {
        padding-bottom: 20px !important;
        /* Reduced from 40px */
        margin-bottom: 20px !important;
        /* Reduced from 40px */
    }
}