/* Font Definition */
@font-face {
    font-family: 'english_font';
    src: url('fonts/supercell-magic.ttf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

/* In-App Purchase Panel Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #4a5568, #2d3748);
    overflow: hidden;
}

.iap-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.iap-panel {
    position: relative;
    background-image: url('./sprites/main_menu/Big_Popup.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    width: 90vw;
    max-width: 800px;
    height: 80vh;
    max-height: 600px;
    min-height: 500px;
    padding: 20px 40px 30px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    padding: 0;
}

.close-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.panel-title {
    position: absolute;
    top: 23px;
    left: 50%;
    transform: translateX(-50%);
    font-family: english_font, sans-serif;
    font-size: 1.875rem;
    font-weight: bold;
    color: #fafff9;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    text-align: center;
    z-index: 1001;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
    height: calc(100% - 60px);
    max-width: 750px;
    margin-top: 60px;
    padding: 0 5px;
}

.product-item {
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-card {
    position: relative;
    background-image: url('./img/shopPopup/open-card.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    width: 105%;
    height: 90%;
    min-height: 168px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 16px 11px 11px 11px;
    transform: scaleX(1.05) scaleY(1.1025);
}

/* Kartları x ekseninde dışa doğru yaklaştırma */
.product-item:nth-child(1) .product-card,
.product-item:nth-child(5) .product-card {
    transform: scaleX(1.05) scaleY(1.1025) translateX(-15px);
}

.product-item:nth-child(2) .product-card,
.product-item:nth-child(6) .product-card {
    transform: scaleX(1.05) scaleY(1.1025) translateX(-5px);
}

.product-item:nth-child(3) .product-card,
.product-item:nth-child(7) .product-card {
    transform: scaleX(1.05) scaleY(1.1025) translateX(5px);
}

.product-item:nth-child(4) .product-card,
.product-item:nth-child(8) .product-card {
    transform: scaleX(1.05) scaleY(1.1025) translateX(15px);
}

/* Coin imajları için özel boyutlandırma */
.product-item:nth-child(1) .product-icon img {
    max-width: 69%; /* %10 büyütme: 63% * 1.10 = 69% */
    max-height: 69%;
}

.product-item:nth-child(3) .product-icon img {
    max-width: 88%; /* %5 büyütme: 84% * 1.05 = 88% */
    max-height: 88%;
}

.product-item:nth-child(4) .product-icon img {
    max-width: 95%; /* %10 küçültme: 105% * 0.90 = 95% */
    max-height: 95%;
}

/* No Ads product (8th item) - %7 küçültme */
.product-item:nth-child(8) .product-icon img {
    max-width: 78%; /* %10 büyütme: 71% * 1.10 = 78% */
    max-height: 78%;
}

.product-description {
    position: absolute;
    top: 0px;
    left: 50%;
    transform: translateX(-50%);
    background-image: url('./sprites/shop/text_back.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding: 4px 13px;
    min-width: 64px;
    width: 57.375%;
    height: 24px;
    text-align: center;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-description span {
    color: #34368d;
    font-family: english_font, sans-serif;
    font-weight: bold;
    font-size: 0.95rem;
    text-shadow:
        1.5px 1.5px 0px #ffffff,
        -1.5px 1.5px 0px #ffffff,
        1.5px -1.5px 0px #ffffff,
        -1.5px -1.5px 0px #ffffff;
}

.product-icon {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: -1px 0 21px 0;
    position: relative;
}

/* Hero product icons - larger and positioned higher */
.hero-product .product-icon {
    margin: -10px 0 15px 0;
}

.product-icon img {
    max-width: 84%;
    max-height: 84%;
    object-fit: contain;
}

/* Hero images - larger size - Higher specificity to override other rules */
.product-item .hero-product .product-icon img {
    max-width: 150% !important;
    max-height: 150% !important;
}

.hero-product {
    flex-direction: column;
}

.hero-image {
    max-width: 95% !important;
    max-height: 95% !important;
    margin-bottom: 5px;
}

.hero-stats {
    position: absolute;
    top: 15px;
    right: -10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    z-index: 10;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.stat-item span {
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.buy-button {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%) scaleY(1.375);
    background-image: url('./sprites/main_menu/green_buy_button.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-color: transparent;
    border: none;
    cursor: pointer;
    width: 89%;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s ease;
}

.buy-button:hover {
    transform: translateX(-50%) scaleY(1.375) scale(1.05);
}

.buy-button:active {
    transform: translateX(-50%) scaleY(1.375) scale(0.95);
}

.buy-button span {
    color: #133f04;
    font-family: english_font, sans-serif;
    font-weight: bold;
    font-size: 0.95rem;
    text-shadow:
        0.5px 0.5px 0px #ffffff,
        -0.5px 0.5px 0px #ffffff,
        0.5px -0.5px 0px #ffffff,
        -0.5px -0.5px 0px #ffffff;
    transform: scaleY(0.727);
}

/* Purchase states */
.buy-button.purchasing {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.buy-button.purchasing span {
    color: #666;
}

.buy-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.buy-button.purchased {
    background-image: url('./sprites/main_menu/green_buy_button.png');
    opacity: 0.8;
}

.buy-button.purchased span {
    color: #0a2a02;
}

/* Warning Message Styles */
.iap-warning {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    width: 90%;
    max-width: 400px;
    animation: slideInFromTop 0.5s ease-out;
}

.warning-content {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    border: 3px solid #ff4757;
    border-radius: 15px;
    padding: 15px 20px;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    animation: pulse 2s infinite;
}

.warning-icon {
    font-size: 1.5rem;
    animation: bounce 1s infinite;
    flex-shrink: 0;
}

.warning-text {
    color: white;
    font-family: english_font, sans-serif;
    font-weight: bold;
    font-size: 0.95rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    flex-grow: 1;
    line-height: 1.3;
}

.warning-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.warning-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Warning Animations */
@keyframes slideInFromTop {
    0% {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
    }
    50% {
        box-shadow: 0 8px 35px rgba(255, 107, 107, 0.6);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-8px);
    }
    60% {
        transform: translateY(-4px);
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-50px);
    }
}

.iap-warning.fade-out {
    animation: fadeOut 0.3s ease-in forwards;
}

.iap-warning.flash {
    animation: flash 0.3s ease-out;
}

@keyframes flash {
    0% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
        box-shadow: 0 8px 35px rgba(255, 107, 107, 0.8);
    }
    100% {
        transform: translateX(-50%) scale(1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .iap-warning {
        width: 95%;
        top: 60px;
    }

    .warning-content {
        padding: 12px 15px;
        gap: 10px;
    }

    .warning-icon {
        font-size: 1.3rem;
    }

    .warning-text {
        font-size: 0.85rem;
    }

    .warning-close {
        width: 22px;
        height: 22px;
        font-size: 1rem;
    }
    .iap-panel {
        width: 95vw;
        height: 85vh;
        padding: 20px 20px 25px 20px;
    }

    .panel-title {
        font-size: 1.5rem;
        top: 13px;
        color: #fafff9;
    }

    .products-grid {
        gap: 6px;
        margin-top: 55px;
        height: calc(100% - 55px);
        padding: 0 3px;
    }

    .product-card {
        height: 86%;
        min-height: 126px;
        padding: 11px 8px 8px 8px;
        transform: scaleX(1.05) scaleY(1.1025);
    }

    /* Tablet responsive kartları dışa yaklaştırma */
    .product-item:nth-child(1) .product-card,
    .product-item:nth-child(5) .product-card {
        transform: scaleX(1.05) scaleY(1.1025) translateX(-12px);
    }

    .product-item:nth-child(2) .product-card,
    .product-item:nth-child(6) .product-card {
        transform: scaleX(1.05) scaleY(1.1025) translateX(-4px);
    }

    .product-item:nth-child(3) .product-card,
    .product-item:nth-child(7) .product-card {
        transform: scaleX(1.05) scaleY(1.1025) translateX(4px);
    }

    .product-item:nth-child(4) .product-card,
    .product-item:nth-child(8) .product-card {
        transform: scaleX(1.05) scaleY(1.1025) translateX(12px);
    }

    /* Tablet responsive coin imajları */
    .product-item:nth-child(1) .product-icon img {
        max-width: 69%;
        max-height: 69%;
    }

    .product-item:nth-child(3) .product-icon img {
        max-width: 88%;
        max-height: 88%;
    }

    .product-item:nth-child(4) .product-icon img {
        max-width: 95%;
        max-height: 95%;
    }

    .product-item:nth-child(8) .product-icon img {
        max-width: 78%;
        max-height: 78%;
    }

    .product-description span {
        color: #34368d;
        font-family: english_font, sans-serif;
        font-size: 0.84rem;
        text-shadow:
            1.2px 1.2px 0px #ffffff,
            -1.2px 1.2px 0px #ffffff,
            1.2px -1.2px 0px #ffffff,
            -1.2px -1.2px 0px #ffffff;
    }

    .product-description {
        top: 0px;
        padding: 3px 11px;
        width: 56.1%;
        height: 22px;
    }

    .buy-button {
        bottom: 11px;
        height: 29px;
        width: 89%;
        transform: translateX(-50%) scaleY(1.375);
    }

    .buy-button span {
        color: #133f04;
        font-family: english_font, sans-serif;
        font-size: 0.84rem;
        text-shadow:
            0.5px 0.5px 0px #ffffff,
            -0.5px 0.5px 0px #ffffff,
            0.5px -0.5px 0px #ffffff,
            -0.5px -0.5px 0px #ffffff;
        transform: scaleY(0.727);
    }

    .close-btn {
        width: 26px;
        height: 26px;
        top: 5px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .iap-panel {
        width: 79.2vw;
        height: 79.2vw;
        max-width: 352px;
        max-height: 352px;
        min-height: 264px;
        padding: 8px;
    }

    .panel-title {
        font-size: 1.1475rem;
        top: 10px;
        color: #fafff9;
    }

    .products-grid {
        gap: 5px;
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(2, 1fr);
        margin-top: 40px;
        height: calc(100% - 50px);
        padding: 0 5px;
    }

    .product-card {
        height: 100%;
        min-height: 100px;
        max-height: 120px;
        padding: 6px 4px 4px 4px;
        transform: scaleX(1.02) scaleY(1.05);
    }

    /* Mobil responsive - 4 sütun için kartları dışa yaklaştırma */
    .product-item:nth-child(1) .product-card,
    .product-item:nth-child(5) .product-card {
        transform: scaleX(1.02) scaleY(1.05) translateX(-4px);
    }

    .product-item:nth-child(2) .product-card,
    .product-item:nth-child(6) .product-card {
        transform: scaleX(1.02) scaleY(1.05) translateX(-1px);
    }

    .product-item:nth-child(3) .product-card,
    .product-item:nth-child(7) .product-card {
        transform: scaleX(1.02) scaleY(1.05) translateX(1px);
    }

    .product-item:nth-child(4) .product-card,
    .product-item:nth-child(8) .product-card {
        transform: scaleX(1.02) scaleY(1.05) translateX(4px);
    }

    /* Mobil responsive coin imajları */
    /* Coin products only - excluding hero products */
    .product-item:nth-child(1) .product-icon img {
        max-width: 69%;
        max-height: 69%;
    }

    .product-item:nth-child(3) .product-icon img {
        max-width: 88%;
        max-height: 88%;
    }

    .product-item:nth-child(4) .product-icon img {
        max-width: 95%;
        max-height: 95%;
    }

    .product-item:nth-child(8) .product-icon img {
        max-width: 78%;
        max-height: 78%;
    }

    .product-description {
        top: 0px;
        padding: 1px 1px;
        width: 12%;
        height: 10px;
        background-size: 60% 100%;
        background-position: center center;
    }

    .product-description span {
        color: #34368d;
        font-family: english_font, sans-serif;
        font-size: 0.4rem;
        text-shadow:
            1px 1px 0px #ffffff,
            -1px 1px 0px #ffffff,
            1px -1px 0px #ffffff,
            -1px -1px 0px #ffffff;
    }

    .buy-button {
        bottom: 6px;
        height: 26px;
        width: 89%;
        transform: translateX(-50%) scaleY(1.03125);
    }

    .buy-button span {
        color: #133f04;
        font-family: english_font, sans-serif;
        font-size: 0.65rem;
        text-shadow:
            0.5px 0.5px 0px #ffffff,
            -0.5px 0.5px 0px #ffffff,
            0.5px -0.5px 0px #ffffff,
            -0.5px -0.5px 0px #ffffff;
        transform: scaleY(0.727);
    }

    .hero-stats {
        top: 12px;
        right: -6px;
        gap: 2px;
    }

    .stat-item {
        gap: 2px;
    }

    .stat-icon {
        width: 14px;
        height: 14px;
    }



    .stat-item span {
        font-size: 0.65rem;
    }
}

/* Extra responsive adjustments for smaller screens */
@media (max-width: 600px) {
    .hero-stats {
        right: -4px;
    }

    .stat-item {
        gap: 1px;
    }

    .stat-icon {
        width: 12px;
        height: 12px;
    }

    .stat-item span {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .hero-stats {
        right: -2px;
    }

    .stat-item {
        gap: 1px;
    }

    .stat-icon {
        width: 10px;
        height: 10px;
    }

    .stat-item span {
        font-size: 0.55rem;
    }
}

@media (max-width: 400px) {
    .hero-stats {
        right: 0px;
    }

    .stat-item {
        gap: 1px;
    }

    .stat-icon {
        width: 9px;
        height: 9px;
    }

    .stat-item span {
        font-size: 0.5rem;
    }

    .close-btn {
        width: 19px;
        height: 19px;
        top: -2px;
        right: 12px;
    }
}

/* Landscape orientation for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .iap-panel {
        height: 95vh;
        padding: 15px 20px 15px 20px;
    }

    .panel-title {
        font-size: 1.125rem;
        top: 7px;
        color: #fafff9;
    }

    .products-grid {
        gap: 5px;
        margin-top: 40px;
        height: calc(100% - 40px);
        padding: 0 2px;
    }

    .product-card {
        height: 84%;
        min-height: 89px;
        padding: 6px 5px 5px 5px;
        transform: scaleX(1.05) scaleY(1.1025);
    }

    /* Landscape responsive kartları dışa yaklaştırma */
    .product-item:nth-child(1) .product-card,
    .product-item:nth-child(5) .product-card {
        transform: scaleX(1.05) scaleY(1.1025) translateX(-6px);
    }

    .product-item:nth-child(2) .product-card,
    .product-item:nth-child(6) .product-card {
        transform: scaleX(1.05) scaleY(1.1025) translateX(-2px);
    }

    .product-item:nth-child(3) .product-card,
    .product-item:nth-child(7) .product-card {
        transform: scaleX(1.05) scaleY(1.1025) translateX(2px);
    }

    .product-item:nth-child(4) .product-card,
    .product-item:nth-child(8) .product-card {
        transform: scaleX(1.05) scaleY(1.1025) translateX(6px);
    }

    /* Landscape responsive coin imajları */
    .product-item:nth-child(1) .product-icon img {
        max-width: 69%;
        max-height: 69%;
    }

    .product-item:nth-child(3) .product-icon img {
        max-width: 88%;
        max-height: 88%;
    }

    .product-item:nth-child(4) .product-icon img {
        max-width: 95%;
        max-height: 95%;
    }

    .product-item:nth-child(8) .product-icon img {
        max-width: 78%;
        max-height: 78%;
    }

    .product-description {
        top: 0px;
        padding: 1px 1px;
        width: 11%;
        height: 9px;
        background-size: 60% 100%;
        background-position: center center;
    }

    .buy-button {
        bottom: 5px;
        height: 23px;
        width: 89%;
        transform: translateX(-50%) scaleY(1.03125);
    }

    .close-btn {
        width: 24px;
        height: 24px;
        top: 0px;
        right: 15px;
    }
}

/* Çok küçük ekranlar için ek optimizasyon */
@media (max-width: 360px) and (max-height: 640px) {
    .iap-panel {
        width: 95vw;
        height: 55vh;
        max-height: 320px;
        padding: 8px;
    }

    .products-grid {
        gap: 3px;
        margin-top: 35px;
        height: calc(100% - 45px);
        padding: 0 3px;
    }

    .product-card {
        min-height: 85px;
        max-height: 100px;
        padding: 4px 2px 2px 2px;
    }

    .product-icon {
        width: 24px;
        height: 24px;
    }

    /* Hero product icons - mobile adjustments */
    .hero-product .product-icon {
        margin: -8px 0 12px 0;
    }

    .product-item .hero-product .product-icon img {
        max-width: 140% !important;
        max-height: 140% !important;
    }

    .product-description span {
        font-size: 0.35rem;
    }

    .buy-button span {
        font-size: 0.6rem;
    }
}
