
/* Auto-buy Section */
.autobuy-wrapper {
    max-width: 1000px;
    margin: 40px auto;
    position: relative;
}

/* Switch Buttons - Positioned at edges, overlapping the main block */
.autobuy-switches {
    display: flex;
    justify-content: space-between;
    margin-bottom: -52px;
    position: relative;
    z-index: 10;
    padding: 0;
    gap: 40px;
}

.autobuy-switch {
    font-family: 'Bangers', cursive;
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: white;
    background: var(--gray);
    border: none;
    border-top: 5px solid var(--black);
    padding: 18px 40px 22px;
    cursor: pointer;
    position: relative;
    box-shadow: none;
    overflow: hidden;
    flex: 1;
    max-width: 52%;
    flex-basis: 52%;
    background-clip: padding-box;
}

.autobuy-switch::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../img/texture2.png');
    background-size: cover;
    background-position: center;
    mix-blend-mode: multiply;
    opacity: 0.3;
    pointer-events: none;
}

.autobuy-switch span {
    position: relative;
    z-index: 2;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.autobuy-switch:first-child {
    /* ровный верх + ровная внешняя (левая) сторона, рваный низ + рваная внутренняя (правая) сторона */
    border-left: 5px solid var(--black);
    border-right: none;
    transform: translate(-18px, 6px) rotate(-1deg);
    clip-path: polygon(
        0 0,
        93% 0,
        100% 40%,
        90% 78%,
        75% 88%,
        60% 96%,
        42% 90%,
        22% 94%,
        6% 86%,
        0 100%
    );
}


.autobuy-switch:first-child::before {
    clip-path: polygon(
        0 0,
        93% 0,
        100% 40%,
        90% 78%,
        75% 88%,
        60% 96%,
        42% 90%,
        22% 94%,
        6% 86%,
        0 100%
    );
}

.autobuy-switch:last-child {
    /* ровный верх + ровная внешняя (правая) сторона, рваный низ + рваная внутренняя (левая) сторона */
    border-right: 5px solid var(--black);
    border-left: none;
    transform: translate(18px, 6px) rotate(1deg);
    clip-path: polygon(
        10% 0,
        100% 0,
        100% 46%,
        92% 80%,
        78% 90%,
        62% 84%,
        44% 94%,
        24% 90%,
        8% 98%,
        0 62%
    );
}


.autobuy-switch:last-child::before {
    clip-path: polygon(
        10% 0,
        100% 0,
        100% 46%,
        92% 80%,
        78% 90%,
        62% 84%,
        44% 94%,
        24% 90%,
        8% 98%,
        0 62%
    );
}


.autobuy-switch--active {
    background: var(--yellow);
    color: var(--black);
    box-shadow: 8px 8px 0 rgba(0,0,0,0.5);
}

.autobuy-switch--active span {
    text-shadow: 2px 2px 0 var(--orange);
}

/* Main Auto-buy Block */
.autobuy-block {
    background: white;
    border: none;
    padding: 50px 40px 40px;
    position: relative;
    clip-path: none;
    transform: none;
    box-shadow: none;
    overflow: hidden;
}

.autobuy-block::before {
    content: none;
}

.autobuy-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.autobuy-content--active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.autobuy-inner {
    position: relative;
    z-index: 2;
}

/* Content gating */
.content-gated-zone {
    position: relative;
    border: none;
    background: white;
    padding: 0;
    overflow: hidden;
}

@media (min-width: 769px) {
    .content-gated-zone {
        padding-top: 7px;
    }
}

.autobuy-actions.content-gated-zone {
    border: 4px solid var(--black);
    outline: none;
    padding: 22px 14px;
}

.gated-content {
    filter: blur(8px) grayscale(40%);
    opacity: 0.5;
    user-select: none;
    pointer-events: none;
}

.content-gate {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: transparent;
    z-index: 5;
}

.content-gate::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('../img/comic_hatching_texture.svg');
    background-size: cover;
    background-position: center;
    opacity: 0.2;
    mix-blend-mode: screen;
    pointer-events: none;
}

.content-gate-card {
    position: relative;
    z-index: 2;
    width: min(620px, 100%);
    border: 6px solid var(--black);
    padding: 26px 24px;
    background: linear-gradient(135deg, var(--yellow) 0%, var(--orange) 100%);
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.45);
    transform: rotate(-0.8deg);
    overflow: hidden;
}

.content-gate-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid var(--black);
    pointer-events: none;
}

.content-gate-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../img/texture2.png');
    background-size: cover;
    background-position: center;
    mix-blend-mode: multiply;
    opacity: 0.35;
    pointer-events: none;
    z-index: 1;
}

.content-gate-title {
    margin: 0 0 10px;
    font-family: 'Bangers', cursive;
    font-size: 1.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--black);
    text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.5);
    position: relative;
    z-index: 3;
}

.content-gate-text,
.content-gate-note {
    margin: 0;
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    color: var(--black);
    position: relative;
    z-index: 3;
}

.content-gate-text {
    font-size: 1.05rem;
    line-height: 1.4;
}

.content-gate-actions {
    margin: 18px 0 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    position: relative;
    z-index: 3;
}

.content-gate-btn {
    width: 100%;
    position: relative;
    z-index: 3;
}

.content-gate-btn--telegram {
    background: var(--blue) !important;
    color: white !important;
}

.content-gate-btn--email {
    background: var(--orange) !important;
    color: var(--black) !important;
}

.content-gate-note {
    font-size: 0.92rem;
    opacity: 0.9;
}

.content-gated-zone--unlocked .gated-content {
    filter: none;
    opacity: 1;
    user-select: auto;
    pointer-events: auto;
}

.content-gated-zone--unlocked .content-gate {
    display: none;
}

.autobuy-title {
    font-family: 'Bangers', cursive;
    font-size: 2rem;
    color: var(--black);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 0 var(--yellow);
    transform: skewX(-3deg);
}

.autobuy-description {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 1.1rem;
    color: var(--dark);
    margin-bottom: 30px;
    font-weight: 700;
}

.autobuy-form {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.autobuy-category {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.autobuy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 24px 16px !important;
}

.autobuy-grid--triple {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 16px;
}

.autobuy-grid--permissions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 16px !important;
}

.autobuy-grid--permissions .autobuy-label {
    white-space: nowrap;
    font-size: 1rem;
}

.autobuy-dual {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px !important;
}

.autobuy-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
    min-width: 0;
}

.autobuy-field:last-child {
    margin-bottom: 0;
}

.autobuy-label {
    font-family: 'Bangers', cursive;
    font-size: 1.1rem;
    color: var(--black);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.autobuy-select,
.autobuy-input {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 1.1rem;
    padding: 15px 20px;
    border: 4px solid var(--black);
    background: white;
    color: var(--dark);
    font-weight: 700;
    transform: skewX(-2deg);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

#purchaseAmount::-webkit-outer-spin-button,
#purchaseAmount::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#purchaseAmount {
    -moz-appearance: textfield;
    appearance: textfield;
}

.autobuy-select:focus,
.autobuy-input:focus {
    outline: none;
    border-color: var(--yellow);
    box-shadow: 6px 6px 0 rgba(0,0,0,0.3);
    transform: skewX(-2deg) translate(-2px, -2px);
}

.autobuy-price-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: var(--yellow);
    border: 5px solid var(--black);
    transform: rotate(-1deg);
    box-shadow: 6px 6px 0 rgba(0,0,0,0.3);
    margin-top: 10px;
}

.autobuy-price-label {
    font-family: 'Bangers', cursive;
    font-size: 1.5rem;
    color: var(--black);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.autobuy-price-value {
    font-family: 'Bangers', cursive;
    font-size: 2rem;
    color: var(--black);
    text-shadow: 2px 2px 0 var(--orange);
}

.autobuy-submit-btn {
    margin-top: 10px;
}

.autobuy-check-rows-btn {
    margin-bottom: 12px;
}

.autobuy-available-rows {
    margin-top: 4px;
}

.autobuy-rows-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 48px;
}

.autobuy-rows-summary-item {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.autobuy-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.autobuy-summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: white;
    border: 4px solid var(--black);
    padding: 14px 16px;
}

.autobuy-summary-label {
    white-space: nowrap;
}

.autobuy-summary-value {
    font-family: 'Bangers', cursive;
    letter-spacing: 1px;
}

.autobuy-prices-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.autobuy-price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f4f8 100%);
    border: 4px solid var(--black);
    transform: rotate(-0.5deg);
    box-shadow: 5px 5px 0 rgba(0,0,0,0.25);
    transition: all 0.3s ease;
}

.autobuy-price-item:nth-child(even) {
    transform: rotate(0.5deg);
    background: linear-gradient(135deg, #fef9e7 0%, #f8f9fa 100%);
}

.autobuy-price-item:hover {
    transform: rotate(0deg) translate(-3px, -3px);
    box-shadow: 8px 8px 0 rgba(0,0,0,0.3);
}

.autobuy-price-item-name {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 1.1rem;
    color: var(--dark);
    font-weight: 700;
}

.autobuy-price-item-value {
    font-family: 'Bangers', cursive;
    font-size: 1.4rem;
    color: var(--orange);
    text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
    .autobuy-wrapper {
        margin: 20px 10px;
    }

    .autobuy-switches {
        flex-direction: row;
        gap: 10px;
        padding: 0;
        margin-bottom: -30px;
    }

    .autobuy-switch {
        font-size: 0.9rem;
        padding: 12px 18px;
        max-width: 50%;
        flex-basis: 50%;
        min-height: auto;
    }

    .autobuy-switch span {
        min-height: 0;
    }

    /* Чуть меньше выступ и наклон для узких экранов */
    .autobuy-switch:first-child {
        transform: translate(-8px, 10px) rotate(-1deg);
    }

    .autobuy-switch:last-child {
        transform: translate(8px, 10px) rotate(1deg);
    }

    /* Отступ заголовков от вкладок на мобильном */
    .autobuy-title {
        margin-top: 18px;
    }

    
    .autobuy-block {
        padding: 40px 20px 30px;
        transform: rotate(0deg);
    }

    .autobuy-title {
        font-size: 1.5rem;
    }

    .autobuy-description {
        font-size: 1rem;
    }

    .autobuy-select,
    .autobuy-input {
        transform: skewX(0deg);
    }

    .autobuy-select:focus,
    .autobuy-input:focus {
        transform: skewX(0deg);
    }

    .autobuy-price-display {
        transform: rotate(0deg);
        padding: 15px 20px;
    }

    .autobuy-price-label {
        font-size: 1.2rem;
    }

    .autobuy-price-value {
        font-size: 1.6rem;
    }

    .autobuy-price-item {
        transform: rotate(0deg) !important;
        padding: 12px 16px;
    }

    .autobuy-price-item:hover {
        transform: rotate(0deg) translate(-2px, -2px) !important;
    }

    .autobuy-price-item-name {
        font-size: 1rem;
    }

    .autobuy-price-item-value {
        font-size: 1.2rem;
    }

    .autobuy-field {
        margin-bottom: 0;
        gap: 8px;
    }

    .autobuy-rows-summary {
        flex-direction: column;
        gap: 10px;
    }

    .autobuy-summary-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .autobuy-summary-card {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .autobuy-field:last-child {
        margin-bottom: 0;
    }

    .autobuy-grid {
        grid-template-columns: 1fr;
        gap: 20px 12px !important;
    }

    .autobuy-grid--triple {
        grid-template-columns: 1fr;
        gap: 20px 12px;
    }

    .autobuy-grid--permissions {
        grid-template-columns: 1fr;
        gap: 20px 12px !important;
    }

    .autobuy-category {
        gap: 0;
    }

    .autobuy-category > * + * {
        margin-top: 20px;
    }

    .autobuy-label {
        line-height: 1.2;
    }

    .autobuy-dual {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px !important;
    }

    .content-gated-zone {
        padding: 0;
    }

    .content-gate {
        padding: 14px;
    }

    .content-gate-card {
        padding: 20px 16px;
        transform: rotate(0deg);
    }

    .content-gate-title {
        font-size: 1.35rem;
    }

    .content-gate-actions {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Info Button Styles - Borderlands style */
.autobuy-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: 6px;
    font-family: 'Bangers', cursive;
    font-size: 1rem;
    color: var(--yellow);
    background: var(--black);
    border: 3px solid var(--yellow);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.4);
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
    vertical-align: middle;
}

.autobuy-info-btn:hover {
    box-shadow: 5px 5px 0 rgba(0,0,0,0.4);
    background: var(--yellow);
    color: var(--black);
}

.autobuy-info-btn:active {
    box-shadow: 2px 2px 0 rgba(0,0,0,0.4);
}

/* Info Modal - Borderlands style */
.info-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.info-modal--active {
    display: flex;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.info-modal-content {
    position: relative;
    background: white;
    border: 6px solid var(--black);
    padding: 40px;
    max-width: 600px;
    width: 100%;
    box-shadow: 12px 12px 0 rgba(0,0,0,0.5);
    transform: rotate(-1deg);
    animation: modalPop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
}

@keyframes modalPop {
    0% {
        transform: scale(0) rotate(-15deg);
        opacity: 0;
    }
    70% {
        transform: scale(1.05) rotate(1deg);
    }
    100% {
        transform: scale(1) rotate(-1deg);
        opacity: 1;
    }
}

.info-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../img/texture2.png');
    background-size: cover;
    background-position: center;
    mix-blend-mode: multiply;
    opacity: 0.2;
    pointer-events: none;
    z-index: 1;
}

.info-modal-content::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 4px solid var(--black);
    pointer-events: none;
    z-index: 2;
}

.info-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-family: 'Bangers', cursive;
    font-size: 2rem;
    color: var(--black);
    background: var(--yellow);
    border: 4px solid var(--black);
    cursor: pointer;
    transform: rotate(5deg);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    z-index: 10;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-modal-close:hover {
    transform: rotate(5deg) translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0,0,0,0.3);
    background: var(--orange);
}

.info-modal-close:active {
    transform: rotate(5deg) translate(1px, 1px);
    box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
}

.info-modal-title {
    position: relative;
    z-index: 3;
    font-family: 'Bangers', cursive;
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    color: var(--black);
    text-shadow: 2px 2px 0 var(--yellow);
    letter-spacing: 2px;
}

.info-modal-text {
    position: relative;
    z-index: 3;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--black);
    font-weight: 500;
    white-space: pre-line;
}

/* Enhanced Select Dropdown - Borderlands style */
.autobuy-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23f4d03f' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 45px !important;
    cursor: pointer;
    position: relative;
}

.autobuy-select:focus {
    outline: none;
}

.autobuy-select option {
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    padding: 10px;
    background: white;
    color: var(--black);
}

.autobuy-select option:hover,
.autobuy-select option:checked {
    background: var(--yellow);
    color: var(--black);
}

/* Mobile responsiveness for info modal */
@media (max-width: 768px) {
    .info-modal-content {
        padding: 30px 20px;
        max-width: 90%;
    }

    .info-modal-title {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }

    .info-modal-text {
        font-size: 1rem;
    }

    .autobuy-info-btn {
        width: 20px;
        height: 20px;
        font-size: 0.85rem;
        margin-left: 4px;
    }

    /* Ensure purchase items maintain desktop layout on mobile */
    .autobuy-field {
        margin-bottom: 20px;
    }

    /* Keep download button styling consistent */
    .comic-btn--small {
        white-space: nowrap;
        min-width: auto;
        padding: 8px 16px !important;
        font-size: 0.85rem !important;
    }
    
    .comic-btn--small span {
        font-size: 0.85rem;
    }
    
    .comic-btn--small img {
        width: 14px !important;
        height: 14px !important;
        margin-right: 6px !important;
    }

    /* Ensure filter text wraps properly if needed */
    .autobuy-field > div > div:nth-child(2) {
        word-break: break-word;
    }
}
