:root {
    --ip-primary: #4f46e5;
    --ip-primary-light: #eef2ff;
    --ip-bg: #f1f5f9;
    --ip-card-radius: 12px;
}

body {
    background: var(--ip-bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--ip-primary), #7c3aed);
}

.drop-zone {
    border: 2px dashed #cbd5e1;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--ip-primary);
    background: var(--ip-primary-light);
}

.drop-zone.drag-over {
    transform: scale(1.01);
}

.image-card {
    border-radius: var(--ip-card-radius);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.image-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
}

.image-card.selected {
    outline: 2px solid var(--ip-primary);
    outline-offset: 2px;
}

.image-card .thumb-wrap {
    aspect-ratio: 4/3;
    background: #e2e8f0;
    overflow: hidden;
}

.image-card .thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tool-badge {
    font-size: 0.7rem;
}

.summary-panel .sticky-lg-top {
    top: 80px;
}

.crop-container {
    max-height: 60vh;
    background: #1e293b;
}

.crop-container img {
    max-width: 100%;
    display: block;
}

.card-tool-panel {
    background: #f8fafc;
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 0.5rem;
}

.card-tools-list {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

/* Lista de herramientas por tarjeta — flex explícito (sin accordion-button) */
.card-tools-list .ip-tool-block {
    border-bottom: 1px solid #e2e8f0;
}

.card-tools-list .ip-tool-block:last-child {
    border-bottom: none;
}

.card-tools-list .ip-tool-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    min-height: 2.5rem;
}

.card-tools-list .ip-tool-chk {
    flex: 0 0 44px;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
}

.card-tools-list .ip-tool-checkbox {
    width: 1.1em;
    height: 1.1em;
    margin: 0;
    padding: 0;
    cursor: pointer;
    vertical-align: middle;
}

.card-tools-list .ip-tool-title {
    flex: 1 1 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    min-width: 0;
    min-height: 2.5rem;
    margin: 0;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: 0;
    outline: none;
    box-shadow: none;
    background: #fff;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    text-align: left;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.card-tools-list .ip-tool-title--label {
    cursor: pointer;
    user-select: none;
}

.card-tools-list .ip-tool-title:not(.collapsed) {
    background: var(--ip-primary-light);
}

.card-tools-list .ip-tool-title-text {
    display: flex;
    align-items: center;
    min-width: 0;
}

.card-tools-list .ip-tool-chevron {
    flex-shrink: 0;
    margin-left: auto;
    font-size: 0.7rem;
    color: #64748b;
    transition: transform 0.2s ease;
}

.card-tools-list .ip-tool-title:not(.collapsed) .ip-tool-chevron {
    transform: rotate(180deg);
}

.card-tools-list .ip-tool-panel-wrap {
    padding: 0 0.75rem 0.75rem 44px;
}

.global-tools-grid {
    --global-box-min-h: 120px;
}

.global-tool-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    min-height: var(--global-box-min-h);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.global-tool-box.is-active {
    border-color: var(--ip-primary);
    box-shadow: 0 0 0 3px var(--ip-primary-light);
    background: #fafbff;
}

.global-tool-box-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0;
}

.global-tool-box.is-active .global-tool-box-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid #e2e8f0;
}

.global-tool-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    cursor: pointer;
    user-select: none;
    line-height: 1.3;
}

.global-tool-title i {
    margin-right: 0.35rem;
}

.global-tool-desc {
    margin: 0.4rem 0 0;
    padding-left: 1.65rem;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.45;
}

.global-tool-box--fixed.is-active .global-tool-box-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.global-tool-box .global-tool-options {
    padding-top: 0.15rem;
}

.global-tool-box .btn-sm {
    font-size: 0.75rem;
    padding: 0.2rem 0.45rem;
}

@media (min-width: 992px) {
    .global-tools-grid > .col-lg-4:nth-child(3n+1) {
        clear: left;
    }
}

.watermark-preview-text {
    pointer-events: none;
}

.processed-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
}

@media (max-width: 991.98px) {
    .summary-panel {
        position: static !important;
    }

    .summary-panel .card {
        margin-bottom: 1rem;
    }

    #globalToolsCollapse:not(.show) + .card-body {
        display: none;
    }

    .drop-zone {
        padding: 2rem 1rem !important;
    }

    .card-tools-list .ip-tool-title {
        font-size: 0.85rem;
    }
}

@media (max-width: 575.98px) {
    .app-header h1 {
        font-size: 1rem;
    }

    .btn-group-sm > .btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

#btnProcess:disabled,
#btnDownloadZip:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Resultado de procesamiento — ahorro de espacio */
.process-result-box {
    background: linear-gradient(145deg, #ecfdf5 0%, #ffffff 55%);
    border: 1px solid #a7f3d0;
    border-radius: var(--ip-card-radius);
    padding: 1.25rem 1rem;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.12);
    animation: ip-result-in 0.35s ease-out;
}

@keyframes ip-result-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.savings-ring-wrap {
    width: 112px;
    height: 112px;
}

.savings-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(#22c55e 0% 0%, #e2e8f0 0% 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.6s ease;
}

.savings-ring-inner {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px #e2e8f0;
}

.savings-ring-pct {
    font-size: 1.35rem;
    font-weight: 700;
    color: #15803d;
    line-height: 1;
}

.savings-headline {
    font-size: 0.95rem;
    font-weight: 600;
    color: #166534;
    line-height: 1.35;
}

.savings-sizes {
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    letter-spacing: 0.02em;
}

.savings-sizes .savings-arrow {
    color: #94a3b8;
    margin: 0 0.35rem;
}

/* —— Espacios publicitarios (ADS) —— */
.ad-slot {
    position: relative;
    overflow: hidden;
    border-radius: var(--ip-card-radius);
    background: #fff;
    border: 1px dashed #cbd5e1;
    text-align: center;
}

.ad-slot__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: inherit;
    width: 100%;
}

.ad-slot--empty .ad-slot__inner {
    min-height: 90px;
}

.ad-slot--leaderboard .ad-slot__inner {
    min-height: 90px;
}

.ad-slot--responsive .ad-slot__inner {
    min-height: 100px;
}

.ad-slot--rectangle .ad-slot__inner {
    min-height: 280px;
}

.ad-slot--sidebar .ad-slot__inner {
    min-height: 250px;
}

.ad-slot--filled {
    border-style: solid;
    border-color: #e2e8f0;
    background: #f8fafc;
}

.ad-slot--filled .ad-slot__inner {
    min-height: 0;
    display: block;
}

.ad-slot--filled ins.adsbygoogle {
    display: block;
    min-height: 90px;
}

.ad-slot--sidebar.ad-slot--filled ins.adsbygoogle {
    min-height: 250px;
}

.ad-slot__badge {
    position: absolute;
    top: 6px;
    left: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
    z-index: 1;
}

.ad-slot__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 1rem;
    color: #94a3b8;
    font-size: 0.8rem;
}

.ad-slot__placeholder i {
    font-size: 1.5rem;
    opacity: 0.65;
}

.ad-slot__size {
    font-size: 0.7rem;
    color: #cbd5e1;
    font-weight: 500;
}

@media (max-width: 991.98px) {
    .ad-slot--sidebar {
        max-width: 336px;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 767.98px) {
    .ad-slot--leaderboard .ad-slot__inner,
    .ad-slot--empty.ad-slot--leaderboard .ad-slot__inner {
        min-height: 100px;
    }
}
