/* ================================================
   DOWNLOADS SYSTEM - ORANGE THEME (UPDATED)
   ================================================ */

/* ================================================
   MAIN CONTAINER
   ================================================ */
.downloads-layout {
    display: flex;
    flex-direction: column;
    padding: 10px;
    width: 100%;
    max-width: 100%;
    min-height: 600px;
    background: linear-gradient(135deg, #1a0f0a 0%, #2d1810 100%);
}

.downloads-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

#downloadsList {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 15px;
}

/* ================================================
   CONTROLS BAR
   ================================================ */
.downloads-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    justify-content: center;
    align-items: center;
    background: linear-gradient(to bottom, #3d2614 0%, #2d1810 100%);
    padding: 12px;
    border: 1px solid #000;
}

.download-search-wrapper {
    flex: 1;
    display: flex;
    gap: 2px;
    min-width: 250px;
}

.download-search-input {
    flex: 1;
    padding: 8px 12px;
    background: #4a2e1a;
    border: 1px solid #000;
    font-size: 13px;
    font-family: Arial, sans-serif;
    color: #fff;
    transition: background 0.2s;
}

.download-search-input:focus {
    outline: none;
    background: #5a3e2a;
}

.download-search-input::placeholder {
    color: #a0826d;
}

.download-search-engine-btn,
.download-sort-btn {
    width: 32px;
    height: 100%;
    min-height: 34px;
    background: linear-gradient(to bottom, #ff8800 0%, #cc6600 100%);
    border: 1px solid #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    padding: 0;
    font-weight: bold;
    transition: all 0.2s;
}

.download-search-engine-btn:hover,
.download-sort-btn:hover {
    background: linear-gradient(to bottom, #ffaa00 0%, #dd7700 100%);
}

.download-search-engine-btn:active,
.download-sort-btn:active {
    background: linear-gradient(to bottom, #cc6600 0%, #ff8800 100%);
}

.download-search-engine-container,
.download-sort-container {
    position: relative;
}

.download-search-engine-menu,
.download-sort-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #3d2614;
    border: 2px solid #ff8800;
    min-width: 220px;
    display: none;
    z-index: 100;
    margin-top: 2px;
}

.download-search-engine-menu.active,
.download-sort-menu.active {
    display: block;
}

.download-search-engine-title,
.download-sort-title {
    font-size: 12px;
    color: #fff;
    padding: 8px 12px;
    background: linear-gradient(to bottom, #ff8800 0%, #cc6600 100%);
    border-bottom: 1px solid #000;
    font-family: Arial, sans-serif;
    font-weight: bold;
    text-transform: uppercase;
}

.download-search-engine-option,
.download-sort-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    font-family: Arial, sans-serif;
    color: #e0d0c0;
    border-bottom: 1px solid #2d1810;
    transition: background 0.15s;
}

.download-search-engine-option:last-child,
.download-sort-option:last-child {
    border-bottom: none;
}

.download-search-engine-option:hover,
.download-sort-option:hover {
    background: #2d1810;
    color: #ff8800;
}

.download-search-engine-option.active,
.download-sort-option.active {
    background: #ff8800;
    color: #fff;
    font-weight: bold;
}

.engine-icon,
.sort-icon {
    display: inline-block;
    width: 20px;
    text-align: center;
    margin-right: 8px;
}

.download-nsfw-container {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #3d2614;
    border: 1px solid #000;
    font-size: 12px;
    font-family: Arial, sans-serif;
}

.download-nsfw-container input[type="checkbox"] {
    cursor: pointer;
    accent-color: #ff8800;
}

.download-nsfw-container label {
    cursor: pointer;
    color: #e0d0c0;
    text-transform: uppercase;
    font-weight: bold;
}

/* ================================================
   STATISTICS BAR
   ================================================ */
.download-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 10px 15px;
    background: linear-gradient(to bottom, #3d2614 0%, #2d1810 100%);
    border: 1px solid #000;
    margin-bottom: 15px;
    grid-column: 1 / -1;
}

.download-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #e0d0c0;
    font-family: Arial, sans-serif;
}

/* ================================================
   GAME CARD
   ================================================ */
.game-card {
    background: linear-gradient(to bottom, #7b4610 0%, #160d02 110%);
    border: 2px solid #1a0f0a;
    padding: 0;
    cursor: pointer;
    transition: all 0.1s;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    border-color: #ff8800;
    transform: translateY(-3px);
}

.game-card.awarded {
    border-color: #ffaa00;
}

.award-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 60px;
    height: 60px;
    z-index: 10;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.award-count {
    position: absolute;
    top: 75px;
    right: 10px;
    background: rgba(255, 170, 0, 0.9);
    color: #000;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
    z-index: 10;
}

.card-logo {
    width: 100%;
    height: 150px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-bottom: 2px solid #3d250a;
}

.card-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ================================================
   CARD GALLERY - ONLY IN POPUP
   ================================================ */
.card-gallery-wrapper {
    width: 100%;
    height: 180px;
    position: relative;
    background: #000;
    overflow: hidden;
}

.card-gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: default;
    pointer-events: none;
}

.card-gallery-main-image.loading {
    background: #000 url('https://img1.picmix.com/output/stamp/normal/2/2/8/8/58822_3cfda.gif') center center no-repeat;
    background-size: 80px 80px;
}

.card-info {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 10px;
    font-family: Arial, sans-serif;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

.card-tag {
    font-size: 10px;
    padding: 3px 8px;
    background: rgba(255, 136, 0, 0.2);
    border: 1px solid rgba(255, 136, 0, 0.4);
    color: #ff8800;
    font-family: Arial, sans-serif;
    text-transform: uppercase;
}

.card-rating-label {
    font-size: 11px;
    color: #a0826d;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 5px;
    font-family: Arial, sans-serif;
}

.card-rating,
.popup-rating {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 8px;
}

.rating-star {
    width: 24px;
    height: 24px;
    cursor: pointer;
    transition: all 0.2s;
    filter: grayscale(100%) brightness(0.3);
}

.rating-star:hover {
    filter: grayscale(50%) brightness(0.6);
    transform: scale(1.1);
}

.rating-star.active {
    filter: grayscale(0%) brightness(1);
    animation: starGlow 1.5s infinite;
}

@keyframes starGlow {
    0%, 100% { filter: grayscale(0%) brightness(1); }
    50% { filter: grayscale(0%) brightness(1.3); }
}

.rating-average {
    font-size: 14px;
    font-weight: bold;
    color: #ff8800;
    margin-left: 8px;
    font-family: Arial, sans-serif;
}

.rating-count {
    font-size: 11px;
    color: #a0826d;
    font-family: Arial, sans-serif;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: #a0826d;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 136, 0, 0.2);
    margin-top: auto;
}

/* ================================================
   IMAGE PREVIEW MODAL
   ================================================ */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 15000;
    display: none;
    justify-content: center;
    align-items: center;
}

.image-preview-overlay.active {
    display: flex;
}

.image-preview-box {
    background: #2d1810;
    border: 3px solid #ff8800;
    width: 70vw;
    height: 70vh;
    display: flex;
    flex-direction: column;
}

.image-preview-titlebar {
    background: linear-gradient(to bottom, #ff8800 0%, #cc6600 100%);
    color: #fff;
    padding: 10px 15px;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: Arial, sans-serif;
    border-bottom: 2px solid #000;
}

.image-preview-close {
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #fff;
    font-size: 18px;
    cursor: pointer;
    color: #fff;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    padding: 0;
    transition: background 0.1s;
}

.image-preview-close:hover {
    background: #c23030;
}

.image-preview-content {
    flex: 1;
    display: flex;
    /* align-items: center; */
    justify-content: center;
    /* padding: 20px; */
    overflow: auto;
    background: #000;
}

.image-preview-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ================================================
   POPUP - LARGER WITH ORANGE THEME
   ================================================ */
.download-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.download-popup-overlay.active {
    display: flex;
}

.download-popup {
    border: 3px solid #ff8800;
    width: 1200px;
    max-width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to top, #160d02 0%, #854b11 100%);
}

.download-popup-titlebar {
    background: linear-gradient(to bottom, #ff8800 0%, #cc6600 100%);
    color: #fff;
    padding: 12px 20px;
    font-weight: bold;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: Arial, sans-serif;
    border-bottom: 2px solid #000;
}

.download-popup-close {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #fff;
    font-size: 20px;
    cursor: pointer;
    color: #fff;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    padding: 0;
    transition: all 0.2s;
}

.download-popup-close:hover {
    background: #c23030;
    
}

.download-popup-body {
    padding: 0;
    color: #e0d0c0;
    font-family: Arial, sans-serif;
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}

.download-popup-body::-webkit-scrollbar {
    width: 12px;
}

.download-popup-body::-webkit-scrollbar-track {
    background: #1a0f0a;
}

.download-popup-body::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #ff8800 0%, #cc6600 100%);
    border: 1px solid #000;
}

.popup-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    padding: 20px;
}

.popup-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.popup-gallery {
    position: relative;
    width: 100%;
    height: 500px;
    background: #000;
    border: 2px solid #ff8800;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.popup-gallery-main {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.popup-gallery-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.popup-gallery-image.active {
    opacity: 1;
}

.popup-gallery-image.loading {
    background: #000 url('https://img1.picmix.com/output/stamp/normal/2/2/8/8/58822_3cfda.gif') center center no-repeat;
    background-size: 100px 100px;
}

.popup-gallery-controls-wrapper {
    background: #0a0605;
    border-top: 1px solid #3d250a;
}

.popup-gallery-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: #1a0f0a;
}

.popup-gallery-btn {
    width: 24px;
    height: 24px;
    background: linear-gradient(to bottom, #ff8800 0%, #cc6600 100%);
    border: 1px solid #000;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.popup-gallery-btn:hover {
    background: linear-gradient(to bottom, #ffaa00 0%, #dd7700 100%);
}

.popup-gallery-counter {
    color: #fff;
    font-size: 12px;
    font-family: Arial, sans-serif;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

.popup-gallery-thumbnails {
    display: flex;
    gap: 3px;
    padding: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    background: #0a0605;
}

.popup-gallery-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.popup-gallery-thumbnails::-webkit-scrollbar-track {
    background: #1a0f0a;
}

.popup-gallery-thumbnails::-webkit-scrollbar-thumb {
    background: #ff8800;
    border-radius: 3px;
}

.popup-gallery-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #ffaa00;
}

.popup-gallery-thumb {
    min-width: 70px;
    height: 44px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
}

.popup-gallery-thumb:hover {
    border-color: #ff8800;
}

.popup-gallery-thumb.active {
    border-color: #ffaa00;
}

.popup-description {
    background: #3d2614;
    padding: 20px;
    border: 2px solid #ff8800;
    border-left: 5px solid #ff8800;
    max-height: 300px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
    color: #e0d0c0;
}

.popup-section {
    margin-bottom: 20px;
}

.popup-section:last-child {
    margin-bottom: 0;
}

.popup-section strong {
    color: #ff8800;
}

.popup-right {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.popup-logo {
    width: 100%;
    height: 200px;
    background: #000;
    border: 2px solid #ff8800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.popup-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.popup-title {
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    font-family: Arial, sans-serif;
    text-align: center;
}

.popup-award {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(to right, #ffaa00 0%, #ff8800 100%);
    padding: 10px;
    border: 2px solid #000;
    color: #000;
    font-weight: bold;
    font-size: 14px;
}

.popup-award img {
    width: 40px;
    height: 40px;
    animation: pulse 2s infinite;
}

.popup-award-count {
    text-align: center;
    background: #3d2614;
    padding: 8px;
    border: 1px solid #ff8800;
    color: #ff8800;
    font-size: 12px;
    font-weight: bold;
}

.popup-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.popup-info-item {
    background: #3d2614;
    padding: 12px;
    border: 2px solid #ff8800;
    border-left: 5px solid #ff8800;
}

.popup-info-label {
    font-size: 10px;
    color: #a0826d;
    text-transform: uppercase;
    margin-bottom: 5px;
    font-weight: bold;
}

.popup-info-value {
    font-size: 15px;
    color: #fff;
    font-weight: bold;
}

.popup-rating-label {
    font-size: 12px;
    color: #a0826d;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 8px;
    font-family: Arial, sans-serif;
}

.popup-rating {
    justify-content: center;
    padding: 10px;
    background: #3d2614;
    border: 2px solid #ff8800;
}

.popup-rating-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #3d2614;
    border: 1px solid #ff8800;
}

.rating-review-text {
    text-align: center;
    padding: 10px;
    background: #3d2614;
    border: 2px solid #ff8800;
    font-weight: bold;
    font-size: 13px;
}

.rating-review-text.bad {
    color: #ff4444;
    border-color: #ff4444;
}

.rating-review-text.neutral {
    color: #ffaa00;
    border-color: #ffaa00;
}

.rating-review-text.good {
    color: #ffee08;
    border-color: #ff8800;
    text-transform: uppercase;
}

.rating-review-text.not-rated-yet {
    color: #a0826d;
}

.popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.popup-btn {
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    font-family: Arial, sans-serif;
    border: 2px solid #000;
    text-transform: uppercase;
    transition: all 0.2s;
    text-align: center;
}

.popup-btn-download {
    background: linear-gradient(to bottom, #ff8800 0%, #cc6600 100%);
    color: #fff;
}

.popup-btn-download:hover {
    background: linear-gradient(to bottom, #ffaa00 0%, #dd7700 100%);
    transform: translateY(-2px);
}

.popup-btn-archive {
    background: linear-gradient(to bottom, #555 0%, #333 100%);
    color: #fff;
}

.popup-btn-archive:hover {
    background: linear-gradient(to bottom, #666 0%, #444 100%);
}

/* ================================================
   LOADING & EMPTY STATES
   ================================================ */
.download-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    background: #3d2614;
    border: 2px solid #ff8800;
}

.download-loading-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px auto;
    background: url('https://img1.picmix.com/output/stamp/normal/2/2/8/8/58822_3cfda.gif') center center no-repeat;
    background-size: contain;
}

.download-loading p {
    color: #e0d0c0;
    font-size: 16px;
    font-weight: bold;
    font-family: Arial, sans-serif;
}

.download-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    background: #3d2614;
    border: 2px solid #ff8800;
}

.download-empty p {
    color: #e0d0c0;
    font-size: 16px;
    font-family: Arial, sans-serif;
}

/* ================================================
   MODAL OVERLAYS
   ================================================ */
.download-modal-overlay,
.download-nsfw-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10001;
    justify-content: center;
    align-items: center;
}

.download-modal-overlay.active,
.download-nsfw-modal-overlay.active {
    display: flex;
}

.download-modal,
.download-nsfw-modal {
    background: #2d1810;
    border: 3px solid #ff8800;
    width: 500px;
    max-width: 90%;
}

.download-modal-titlebar,
.download-nsfw-modal-titlebar {
    background: linear-gradient(to right, #c23030 0%, #911 100%);
    color: #fff;
    padding: 12px 20px;
    font-weight: bold;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: Arial, sans-serif;
    border-bottom: 2px solid #000;
}

.download-modal-titlebar.warning {
    background: linear-gradient(to right, #ff8800 0%, #cc6600 100%);
}

.download-modal-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #fff;
    font-weight: bold;
}

.download-modal-body,
.download-nsfw-modal-content {
    padding: 20px;
    color: #e0d0c0;
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

.download-modal-warning-box {
    background: #3d2614;
    padding: 15px;
    border: 2px solid #ff8800;
    border-left: 5px solid #ff8800;
    margin-bottom: 15px;
}

.download-modal-list {
    margin: 10px 0 10px 20px;
    color: #a0826d;
}

.download-modal-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    cursor: pointer;
}

.download-modal-checkbox input {
    accent-color: #ff8800;
}

.download-modal-footer,
.download-nsfw-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 15px 20px;
    background: #3d2614;
    border-top: 2px solid #ff8800;
}

.download-modal-btn,
.download-nsfw-modal-btn {
    padding: 10px 24px;
    background: linear-gradient(to bottom, #ff8800 0%, #cc6600 100%);
    border: 2px solid #000;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    font-family: Arial, sans-serif;
    text-transform: uppercase;
    transition: all 0.2s;
}

.download-modal-btn:hover,
.download-nsfw-modal-btn:hover {
    background: linear-gradient(to bottom, #ffaa00 0%, #dd7700 100%);
}

.download-modal-btn.primary,
.download-nsfw-modal-btn.confirm {
    background: linear-gradient(to bottom, #ff8800 0%, #cc6600 100%);
}

.download-nsfw-modal-warning {
    background: #3d2614;
    padding: 15px;
    border: 2px solid #c23030;
    border-left: 5px solid #c23030;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.8;
}

/* ================================================
   POSTAL BUTTON FIX
   ================================================ */
#postalButtonMain {
    width: 60px;
    height: 60px;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    padding: 0;
    box-shadow: none !important;
    outline: none !important;
}

#postalButtonMain:hover {
    transform: scale(1.05);
    transition: transform 0.15s;
}

#postalButtonMain:active {
    transform: scale(0.95);
}

#postalButtonMain img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1400px) {
    .download-popup {
        width: 1000px;
    }
    
    .popup-gallery {
        height: 400px;
    }
}

@media (max-width: 1024px) {
    .download-popup {
        width: 95%;
    }
    
    .popup-content {
        grid-template-columns: 1fr;
    }
    
    .popup-gallery {
        height: 350px;
    }
    
    #downloadsList {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .downloads-layout {
        padding: 5px;
    }
    
    .popup-gallery {
        height: 250px;
    }
    
    .popup-logo {
        height: 150px;
    }
    
    #downloadsList {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}