/**
 * Planleg Tilbudsliste — Frontend Styles
 * Clean, modern design — shadcn/ui inspired
 */

/* =========================================
   Tilbudsliste button — single product pages
   ========================================= */

.planleg-tilbudsliste-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background-color: #6AA53A;
    color: #fff !important;
    font-family: inherit;
    position: relative;
    margin-top: 12px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.planleg-tilbudsliste-btn svg {
    vertical-align: middle;
    flex-shrink: 0;
}

.planleg-tilbudsliste-btn:hover {
    background-color: #5c9132;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.planleg-tilbudsliste-btn:active {
    transform: scale(0.98);
}

.planleg-tilbudsliste-btn:focus-visible {
    outline: 2px solid #6AA53A;
    outline-offset: 2px;
}

/* Loading — subtle shimmer, no spinner */
.planleg-tilbudsliste-btn.loading {
    pointer-events: none;
    animation: planleg-pulse 1.2s ease-in-out infinite;
}

.planleg-tilbudsliste-btn.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: planleg-shimmer 1.2s ease-in-out infinite;
}

@keyframes planleg-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}

@keyframes planleg-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Success state */
.planleg-tilbudsliste-btn.added {
    background-color: #16a34a;
    pointer-events: none;
    animation: none;
}

/* Icon */
.planleg-btn-icon {
    flex-shrink: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.planleg-btn-text {
    transition: opacity 0.15s ease;
}

.planleg-tilbudsliste-btn.loading .planleg-btn-text {
    opacity: 0.6;
}

.planleg-tilbudsliste-btn.loading .planleg-btn-icon-list {
    animation: planleg-icon-pulse 0.8s ease-in-out infinite;
}

@keyframes planleg-icon-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* =========================================
   Quantity controls — shared everywhere
   ========================================= */

.planleg-qty-control {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    height: 36px;
}

.planleg-qty-minus,
.planleg-qty-plus {
    width: 34px;
    height: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 400;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #3f3f46;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.planleg-qty-minus:hover,
.planleg-qty-plus:hover {
    background: #f4f4f5;
    color: #18181b;
}

.planleg-qty-minus:active,
.planleg-qty-plus:active {
    background: #e4e4e7;
}

.planleg-qty-input {
    width: 40px;
    height: 100%;
    text-align: center;
    border: none;
    border-left: 1px solid #e4e4e7;
    border-right: 1px solid #e4e4e7;
    font-size: 13px;
    font-weight: 500;
    color: #18181b;
    padding: 0;
    background: transparent;
    -moz-appearance: textfield;
    appearance: textfield;
}

.planleg-qty-input:focus {
    outline: none;
    background: #fafafa;
}

.planleg-qty-input::-webkit-inner-spin-button,
.planleg-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* =========================================
   Remove item button — shared
   ========================================= */

.planleg-remove-item {
    background: none;
    border: 1px solid transparent;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 18px;
    color: #a1a1aa;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s ease;
    line-height: 1;
}

.planleg-remove-item:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

/* =========================================
   Tilbudsliste page — product table
   ========================================= */

.planleg-tilbudsliste-page {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.planleg-tilbudsliste-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 32px;
}

.planleg-tilbudsliste-table thead th {
    text-align: left;
    padding: 0 12px 12px;
    border-bottom: 1px solid #e4e4e7;
    font-weight: 500;
    font-size: 13px;
    color: #71717a;
}

.planleg-tilbudsliste-table tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid #f4f4f5;
    vertical-align: middle;
    font-size: 14px;
    color: #3f3f46;
}

.planleg-tilbudsliste-table tbody tr {
    transition: opacity 0.25s ease, background 0.12s ease;
}

.planleg-tilbudsliste-table tbody tr:hover {
    background: #fafafa;
}

.planleg-tilbudsliste-table tbody tr.removing {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tilbudsliste-col-thumb { width: 56px; }
.tilbudsliste-col-thumb img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #f4f4f5;
}

.tilbudsliste-col-name a {
    color: #18181b;
    text-decoration: none;
    font-weight: 500;
}
.tilbudsliste-col-name a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.tilbudsliste-col-remove { width: 40px; text-align: center; }
.tilbudsliste-col-qty { width: 130px; }

/* Empty state */
.planleg-tilbudsliste-empty {
    text-align: center;
    padding: 48px 24px;
    color: #71717a;
    font-size: 15px;
}

.planleg-tilbudsliste-empty .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    padding: 0 20px;
    height: 40px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    background: #18181b;
    color: #fafafa;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}
.planleg-tilbudsliste-empty .button:hover {
    background: #27272a;
}

/* Form wrapper — full width */
.planleg-tilbudsliste-form-wrap {
    width: 100% !important;
    max-width: 100% !important;
}

.planleg-tilbudsliste-form-wrap .gform_wrapper,
.planleg-tilbudsliste-form-wrap .gform_wrapper.gravity-theme,
.planleg-tilbudsliste-page .gform_wrapper,
.planleg-tilbudsliste-page .gform_wrapper.gravity-theme,
#page .planleg-tilbudsliste-form-wrap .gform_wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.planleg-tilbudsliste-form-wrap .gform_wrapper .gform_body,
.planleg-tilbudsliste-form-wrap .gform_wrapper .gform-body,
.planleg-tilbudsliste-form-wrap .gform_wrapper .gform_fields,
.planleg-tilbudsliste-form-wrap .gform_wrapper.gravity-theme .gform_body,
.planleg-tilbudsliste-form-wrap .gform_wrapper.gravity-theme .gform-body,
.planleg-tilbudsliste-form-wrap .gform_wrapper.gravity-theme .gform_fields {
    width: 100% !important;
    max-width: 100% !important;
}

.planleg-tilbudsliste-gf-field {
    width: 100% !important;
    max-width: 100% !important;
}

/* Force the GF field container to full width (GF 2.5+ grid layout) */
.gfield.gfield--type-tilbudsliste {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.planleg-tilbudsliste-form-notice {
    margin-top: 20px;
    padding: 14px 16px;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 8px;
    font-size: 14px;
    color: #92400e;
}

/* =========================================
   Badge count in navigation menu
   ========================================= */

.planleg-tilbudsliste-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    background-color: #18181b;
    border-radius: 9px;
    margin-left: 5px;
    vertical-align: middle;
}

.planleg-tilbudsliste-badge.planleg-badge-empty {
    display: none;
}

/* =========================================
   GF field — editable product table (no thumbnails)
   ========================================= */

.planleg-tilbudsliste-gf-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.planleg-tilbudsliste-gf-table thead th {
    text-align: left;
    padding: 0 10px 10px;
    border-bottom: 1px solid #e4e4e7;
    font-weight: 500;
    font-size: 13px;
    color: #71717a;
}

.planleg-tilbudsliste-gf-table tbody td {
    padding: 10px;
    border-bottom: 1px solid #f4f4f5;
    vertical-align: middle;
    font-size: 14px;
    color: #3f3f46;
}

.planleg-tilbudsliste-gf-table tbody tr {
    transition: opacity 0.25s ease, background 0.12s ease;
}

.planleg-tilbudsliste-gf-table tbody tr:hover {
    background: #fafafa;
}

.planleg-tilbudsliste-gf-table tbody tr.removing {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gf-tbl-name a {
    color: #18181b;
    text-decoration: none;
    font-weight: 500;
}
.gf-tbl-name a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}
.gf-tbl-qty { width: 120px; }
.gf-tbl-remove { width: 36px; text-align: center; }

.planleg-gf-empty {
    padding: 24px;
    text-align: center;
    color: #a1a1aa;
    background: #fafafa;
    border: 1px dashed #e4e4e7;
    border-radius: 8px;
    font-size: 14px;
}

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 768px) {
    .planleg-tilbudsliste-table thead,
    .planleg-tilbudsliste-gf-table thead {
        display: none;
    }

    .planleg-tilbudsliste-table tbody tr,
    .planleg-tilbudsliste-gf-table tbody tr {
        display: block;
        padding: 14px 0;
        border-bottom: 1px solid #f4f4f5;
    }

    .planleg-tilbudsliste-table tbody td,
    .planleg-tilbudsliste-gf-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 4px 0;
        border-bottom: none;
    }

    .planleg-tilbudsliste-table tbody td::before,
    .planleg-tilbudsliste-gf-table tbody td::before {
        font-weight: 500;
        font-size: 13px;
        color: #71717a;
    }

    .tilbudsliste-col-thumb { width: auto; }
    .tilbudsliste-col-thumb::before { content: ''; }
    .tilbudsliste-col-name::before,
    .gf-tbl-name::before { content: 'Produkt'; }
    .tilbudsliste-col-sku::before,
    .gf-tbl-sku::before { content: 'Produktnr.'; }
    .tilbudsliste-col-variant::before,
    .gf-tbl-variant::before { content: 'Variant'; }
    .tilbudsliste-col-qty::before,
    .gf-tbl-qty::before { content: 'Antal'; }
    .tilbudsliste-col-remove::before,
    .gf-tbl-remove::before { content: ''; }

    .tilbudsliste-col-qty,
    .gf-tbl-qty { width: auto; }

    .planleg-tilbudsliste-btn { max-width: 100%; }
}
