/**
 * Gorillah Dynamic Engine — Frontend Styles
 *
 * Keep this file limited to plugin-specific frontend structure and behavior.
 * Avoid duplicating GorillaH DS global primitives here.
 */

:root {
    --ade-surface: #ffffff;
    --ade-surface-soft: #f8fafc;
    --ade-surface-muted: #f5f7fa;
    --ade-border: #d7dee7;
    --ade-border-strong: #c2cbd6;
    --ade-text: #1b2126;
    --ade-text-soft: #5f6b76;
    --ade-text-faint: #7f8a94;
    --ade-accent: #00ffff;
    --ade-accent-strong: #00b9b9;
    --ade-accent-soft: rgba(0, 255, 255, 0.12);
    --ade-success: #3bb535;
    --ade-danger: #e84b30;
    --ade-overlay: rgba(0, 0, 0, 0.86);
    --ade-radius-sm: 4px;
    --ade-radius: 6px;
    --ade-shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.08);
    --ade-shadow-lg: 0 18px 60px rgba(0, 0, 0, 0.45);
    --ade-space-2: 8px;
    --ade-space-3: 12px;
    --ade-space-4: 16px;
    --ade-space-5: 24px;
    --ade-space-6: 32px;
}

.ade-form-wrap {
    max-width: 800px;
    margin: 20px auto;
    padding: 30px;
    background: var(--ade-surface);
    border: 1px solid var(--ade-border);
    border-radius: var(--ade-radius);
    box-shadow: var(--ade-shadow-sm);
    color: var(--ade-text);
}

.ade-form-section {
    margin-bottom: 25px;
}

.ade-form-section label {
    display: block;
    margin-bottom: var(--ade-space-2);
    font-weight: 600;
    font-size: 14px;
    color: var(--ade-text);
}

.ade-form input[type="text"],
.ade-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--ade-border);
    border-radius: var(--ade-radius-sm);
    background: var(--ade-surface);
    color: var(--ade-text);
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ade-form input:focus,
.ade-form textarea:focus {
    border-color: var(--ade-accent-strong);
    outline: none;
    box-shadow: 0 0 0 3px var(--ade-accent-soft);
}

.ade-fe-gallery-preview {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ade-space-2);
    margin-bottom: var(--ade-space-3);
    min-height: 60px;
    padding: 10px;
    background: var(--ade-surface-soft);
    border: 1px dashed var(--ade-border-strong);
    border-radius: var(--ade-radius-sm);
}

.ade-fe-gallery-item-wrap {
    width: 60px;
    height: 60px;
    overflow: hidden;
    border: 1px solid var(--ade-border);
    border-radius: var(--ade-radius-sm);
    cursor: move !important;
}

.ade-fe-gallery-item-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
}

.ade-fe-gallery-placeholder {
    width: 60px;
    height: 60px;
    border: 1px dashed var(--ade-accent-strong);
    border-radius: var(--ade-radius-sm);
    background: var(--ade-accent-soft);
}

.ade-fe-blocks-wrapper {
    margin-bottom: 15px;
}

.ade-fe-block-item {
    margin-bottom: 10px;
    border: 1px solid var(--ade-border);
    border-radius: var(--ade-radius);
    background: var(--ade-surface);
}

.ade-fe-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 15px;
    border-bottom: 1px solid var(--ade-border);
    background: var(--ade-surface-muted);
    cursor: move;
}

.ade-fe-block-title {
    color: var(--ade-text-soft);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.ade-fe-block-remove {
    border: 0;
    background: none;
    color: var(--ade-text-faint);
    font-size: 20px;
    cursor: pointer;
}

.ade-fe-block-body {
    padding: 15px;
}

.ade-fe-block-body input,
.ade-fe-block-body textarea {
    margin-bottom: 10px;
}

.ade-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid var(--ade-border-strong);
    border-radius: var(--ade-radius-sm);
    background: var(--ade-surface);
    color: var(--ade-text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.ade-btn-upload {
    background: var(--ade-surface-muted);
}

.ade-btn-submit {
    width: 100%;
    padding: 12px 24px;
    border-color: var(--ade-accent);
    background: var(--ade-accent);
    color: var(--ade-text);
    font-size: 15px;
}

.ade-btn-submit:hover {
    background: var(--ade-accent-strong);
    border-color: var(--ade-accent-strong);
    box-shadow: 0 0 0 3px var(--ade-accent-soft);
}

.ade-form-footer {
    margin-top: 30px;
    text-align: center;
}

#ade-form-message {
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 500;
}

#ade-form-message.ade-success {
    color: var(--ade-success);
}

#ade-form-message.ade-error {
    color: var(--ade-danger);
}

.ade-loading {
    opacity: 0.6;
    pointer-events: none;
}

.ade-single-header {
    margin-bottom: 24px;
}

.ade-single-title {
    margin: 0 0 var(--ade-space-2);
}

.ade-single-subtitle {
    margin: 0;
}

.ade-single-content {
    margin-bottom: var(--ade-space-6);
}

.ade-single-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--ade-space-3);
    margin-bottom: var(--ade-space-6);
}

.ade-single-gallery-item {
    display: block;
    overflow: hidden;
    line-height: 0;
    cursor: pointer;
}

.ade-single-gallery-item img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ade-single-gallery-item:hover img {
    transform: scale(1.04);
}

.ade-single-blocks {
    display: flex;
    flex-direction: column;
    gap: var(--ade-space-4);
}

.ade-block-item {
    padding: var(--ade-space-4);
}

.ade-block-header {
    display: flex;
    align-items: center;
    gap: var(--ade-space-2);
    margin-bottom: var(--ade-space-2);
}

.ade-block-icon {
    flex-shrink: 0;
    font-size: 20px;
}

.ade-block-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ade-block-desc {
    margin: 0;
}

.ade-block-desc p:last-child {
    margin-bottom: 0;
}

.ade-items-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.ade-item-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.ade-item-thumbnail {
    display: block;
    overflow: hidden;
}

.ade-item-thumbnail a {
    display: block;
    line-height: 0;
}

.ade-item-thumbnail img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.ade-item-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: var(--ade-space-4);
}

.ade-item-title {
    margin: 0 0 var(--ade-space-2);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.ade-item-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.ade-items-grid .ade-item-title a:hover {
    opacity: 0.7;
}

.ade-item-excerpt {
    margin: 0 0 var(--ade-space-4);
    font-size: 14px;
    line-height: 1.6;
}

.ade-item-link {
    display: inline-block;
    align-self: flex-start;
    margin-top: auto;
    padding: 8px 16px;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.ade-no-results {
    margin: 0;
}

.ade-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: var(--ade-space-6);
}

.ade-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--ade-border);
    border-radius: var(--ade-radius-sm);
    color: inherit;
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s ease;
}

.ade-pagination .page-numbers.current {
    border-color: var(--ade-text);
    background: var(--ade-text);
    color: var(--ade-surface);
}

.ade-filter-bar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ade-space-3);
    margin-bottom: 24px;
    padding-bottom: 8px;
    overflow: hidden;
}

.ade-filter-search,
.ade-filter-select {
    height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--ade-border);
    border-radius: var(--ade-radius-sm);
    background: var(--ade-surface);
    color: var(--ade-text);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ade-filter-search:focus,
.ade-filter-select:focus {
    border-color: var(--ade-text-soft);
}

.ade-filter-search {
    flex: 1;
    min-width: 140px;
}

.ade-filter-select {
    cursor: pointer;
}

.ade-filter-clear {
    height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--ade-border);
    border-radius: var(--ade-radius-sm);
    background: var(--ade-surface-muted);
    color: var(--ade-text);
    cursor: pointer;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.ade-filter-clear:hover:not(:disabled) {
    background: var(--ade-border);
}

.ade-filter-clear:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ade-filter-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 10;
    width: 100%;
    height: 4px;
    background: transparent;
}

.ade-filter-progress::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: var(--ade-accent-strong);
    opacity: 0;
    transition: width 0.3s ease, opacity 0.3s ease;
}

.elementor-widget-container.ade-is-filtering .ade-filter-progress::before {
    opacity: 1;
    animation: ade-progress-anim 3s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes ade-progress-anim {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

.ade-card-edit-btn {
    position: absolute;
    top: var(--ade-space-2);
    right: var(--ade-space-2);
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 6px;
    border-radius: var(--ade-radius-sm);
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    text-decoration: none;
    opacity: 0.85;
    box-sizing: border-box;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.ade-item-card:hover .ade-card-edit-btn,
.ade-card-edit-btn:hover {
    opacity: 1;
}

.ade-card-edit-btn:hover {
    background: rgba(0, 0, 0, 0.95);
}

.ade-card-edit-btn svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.ade-load-more-wrap {
    margin-top: var(--ade-space-6);
    text-align: center;
}

.ade-load-more-btn {
    padding: 10px 28px;
    border: 1px solid var(--ade-border);
    border-radius: var(--ade-radius-sm);
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.ade-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ade-block-item--img,
.ade-block-unit--img {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: var(--ade-space-4);
}

.ade-block-item--img .ade-block-media,
.ade-block-unit--img .ade-block-unit-media {
    flex: 0 0 auto;
    width: 120px;
}

.ade-block-item--img .ade-block-media-img,
.ade-block-unit--img .ade-block-unit-img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: var(--ade-radius-sm);
}

.ade-block-unit--img .ade-block-unit-media a,
.ade-block-item--img .ade-block-media a {
    display: block;
    cursor: zoom-in;
}

.ade-block-item--img .ade-block-body,
.ade-block-unit--img .ade-block-unit-body {
    flex: 1 1 auto;
    min-width: 0;
}

.ade-shadowbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--ade-space-6);
    background: var(--ade-overlay);
    box-sizing: border-box;
}

.ade-shadowbox.is-open {
    display: flex;
}

.ade-shadowbox-img {
    display: block;
    max-width: min(100%, 1200px);
    max-height: 90vh;
    object-fit: contain;
    box-shadow: var(--ade-shadow-lg);
}

.ade-shadowbox-close {
    position: absolute;
    top: var(--ade-space-4);
    right: var(--ade-space-4);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: var(--ade-radius-sm);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    cursor: pointer;
    font-size: 30px;
    line-height: 1;
}

body.ade-shadowbox-open {
    overflow: hidden;
}

@media (max-width: 480px) {
    .ade-block-item--img,
    .ade-block-unit--img {
        flex-direction: column;
    }

    .ade-block-item--img .ade-block-media,
    .ade-block-unit--img .ade-block-unit-media {
        width: 100%;
    }
}
