/* ── Widget system — public site styles ─────────────────── */

/* Container & background variants */
.widget-container {
    border-radius: var(--radius-small);
    overflow: hidden;
}

.widget-bg--light-grey   { background: #f3f4f5; }
.widget-bg--light-blue   { background: #e8f4fb; }
.widget-bg--white-card   { background: #ffffff; box-shadow: 0 2px 10px rgba(0,0,0,0.07); }
.widget-bg--light-yellow { background: #fffde8; }
.widget-bg--light-peach  { background: #fef6ea; }

/* Border */
.widget--bordered { border: 1px solid var(--color-border-card); }

/* Spacing */
.widget-spacing-top--none   { padding-top: 0; }
.widget-spacing-top--small  { padding-top: 7px; }
.widget-spacing-top--medium { padding-top: 15px; }
.widget-spacing-top--large  { padding-top: 25px; }

.widget-spacing-bottom--none   { padding-bottom: 0; }
.widget-spacing-bottom--small  { padding-bottom: 7px; }
.widget-spacing-bottom--medium { padding-bottom: 15px; }
.widget-spacing-bottom--large  { padding-bottom: 25px; }

/* Widget title */
.widget-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary);
    line-height: 1.3;
}

/* Error placeholder */
.widget-error {
    padding: 10px 14px;
    font-size: 14px;
    color: #c0392b;
    background: #fdf0ee;
    border-radius: 6px;
    border: 1px solid #f0c0bb;
}

/* Mobile visibility */
@media (max-width: 767px) {
    .widget--hide-mobile { display: none !important; }

    /* Sidebar moves below main content on mobile */
    .page-main-aside {
        gap: var(--space-xl);
    }
}

/* ── Length Converter widget ─────────────────────────────── */

/* Single flat grid: auto (labels) | 1fr (inputs).
   Ref spans flow into the same columns, so right-col refs
   align exactly with the input fields above them. */
.widget-length-converter {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 7px 12px;
    align-items: center;
}

.wlc__label {
    font-size: 17px;
    font-weight: 600;
    color: var(--color-text-body);
    white-space: nowrap;
}

.wlc__input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-small);
    font-size: 17px;
    font-family: var(--font-family);
    color: var(--color-text-heading);
    background: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
    -moz-appearance: textfield;
}

.wlc__input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(32, 116, 164, 0.12);
}

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

.wlc__ref {
    font-size: 17px;
    color: #2074a4;
}

.widget-length-converter > :nth-child(11),
.widget-length-converter > :nth-child(12) {
    margin-top: -2px;
}

/* ── Paper Size Table widget ─────────────────────────── */

.widget-paper-sizes {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.4;
}

.widget-paper-sizes thead th {
    text-align: left;
    font-weight: 700;
    color: var(--color-text-heading);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 8px 6px;
    border-bottom: 2px solid var(--color-border-card);
}

.widget-paper-sizes tbody td {
    padding: 5px 8px;
    color: var(--color-text-body);
}

.widget-paper-sizes tbody td:first-child {
    font-weight: 600;
}

.widget-paper-sizes tbody tr:nth-child(even) td {
    background: rgba(255,255,255,0.55);
}

/* ── Artwork Specs widget ────────────────────────────── */

.widget-artwork-specs {
    margin: 0;
    padding: 0;
}

.was__row {
    display: flex;
    gap: 8px;
    padding: 5px 8px;
    font-size: 17px;
    line-height: 1.4;
    align-items: baseline;
}

.was__row:nth-child(even) {
    background: rgba(255,255,255,0.55);
}

.was__row dt {
    font-weight: 700;
    color: var(--color-text-heading);
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 0;
}

.was__row dt::after {
    content: ':';
}

.was__row dd {
    margin: 0;
    color: var(--color-text-body);
    min-width: 0;
}

/* ── Calculator widget ───────────────────────────────── */

.widget-calculator {
    user-select: none;
    outline: none;
}

.wcalc__display {
    background: #ffffff;
    border: 1px solid #d0d3d7;
    border-radius: var(--radius-small);
    padding: 5px 14px 5px;
    margin-bottom: 8px;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 2px;
}

.wcalc__expr {
    font-size: 12px;
    color: #aaaaaa;
    min-height: 16px;
    word-break: break-all;
    text-align: right;
}

.wcalc__val {
    font-size: 44px;
    font-weight: 400;
    color: var(--color-text-heading);
    word-break: break-all;
    text-align: right;
    line-height: 1.1;
}

.wcalc__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.wcalc__btn {
    background: #ffffff;
    border: 1px solid #d0d3d7;
    border-radius: var(--radius-small);
    font-size: 18px;
    font-weight: 500;
    color: var(--color-text-heading);
    padding: 0;
    height: 48px;
    cursor: pointer;
    transition: background 0.1s, transform 0.07s;
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.wcalc__btn:hover  { background: #f0f1f3; }
.wcalc__btn:active { transform: scale(0.93); }

.wcalc__btn--fn  { background: #d6e8f5; color: #1a5f87; border-color: #b3d4ec; }
.wcalc__btn--fn:hover { background: #c2daf0; }

.wcalc__btn--op  { background: #2074a4; color: #ffffff; font-weight: 400; font-size: 30px; border-color: #2074a4; }
.wcalc__btn--op:hover  { background: #1a5f87; }

.wcalc__btn--eq  { background: #e67e22; color: #ffffff; font-weight: 400; font-size: 30px; border-color: #e67e22; }
.wcalc__btn--eq:hover  { background: #d35400; }

.wcalc__btn--zero { grid-column: span 2; }

@media (max-width: 767px) {
    .wcalc__btn { height: 52px; font-size: 20px; }
    .wcalc__btn--op { font-size: 32px; }
    .wcalc__btn--eq { font-size: 32px; }
    .wcalc__val { font-size: 48px; }
}

/* ── Featured Articles widget ────────────────────────── */

.widget-featured-articles {
    display: flex;
    flex-direction: column;
    gap: 17px;
}

.wfa__item {
    display: flex;
    gap: 20px;
    text-decoration: none;
    color: inherit;
    align-items: flex-start;
    transition: opacity 0.15s;
}

.wfa__item:hover { opacity: 0.82; }

.wfa__item--no-thumb { gap: 0; }

.wfa__thumb {
    flex-shrink: 0;
    width: 90px;
    height: 90px;
    border-radius: 4px;
    overflow: hidden;
}

.wfa__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wfa__body {
    flex: 1;
    min-width: 0;
    margin-top: -2px;
}

.wfa__title {
    font-size: 19px;
    font-weight: 600;
    color: var(--color-primary);
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wfa__excerpt {
    font-size: 16px;
    color: var(--color-text-light);
    margin-top: 2px;
    line-height: 1.4;
}

/* ── Contact Card widget ─────────────────────────────── */

.widget-contact-card {
    display: flex;
    flex-direction: column;
}

/* Single row: phone link + social icons */
.wcc__contact-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Phone link */
.wcc__phone-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--color-text-heading);
    transition: color 0.15s;
}

.wcc__phone-link:hover { color: var(--color-primary); }

.wcc__phone-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.wcc__phone-link:hover .wcc__phone-icon { opacity: 1; }

.wcc__phone-icon img { display: block; width: 28px; height: 28px; }

.wcc__phone-number {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* Social icon links */
.wcc__social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.82;
    transition: opacity 0.15s, transform 0.15s;
    text-decoration: none;
}

.wcc__social-link:hover {
    opacity: 1;
    transform: scale(1.1);
}

.wcc__social-link img { display: block; width: 32px; height: 32px; }

/* ── Tools widget ────────────────────────────────────── */

.wtools__icons {
    display: flex;
    gap: 5px;
}

.wtools__icon-btn {
    flex: 1;
    aspect-ratio: 1;
    background: #ffffff;
    border: 1px solid #d0d3d7;
    border-radius: var(--radius-small);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    color: var(--color-text-heading);
    padding: 0;
}

.wtools__icon-btn svg {
    width: 36px;
    height: 36px;
}

.wtools__icon-btn:hover {
    background: #f0f1f3;
    border-color: #b0b5bb;
    color: var(--color-text-heading);
}

.wtools__icon-btn--active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

.wtools__panel {
    margin-top: 12px;
    padding-top: 0;
}

.wtools__panel-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* ── VAT Calculator ──────────────────────────────────── */

.wtvat__display {
    background: #ffffff;
    border: 1px solid #d0d3d7;
    border-radius: var(--radius-small);
    padding: 6px 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: baseline;
    gap: 4px;
    min-height: 56px;
    justify-content: flex-end;
}

.wtvat__prefix {
    font-size: 26px;
    font-weight: 400;
    color: #aaaaaa;
    flex-shrink: 0;
}

.wtvat__amount {
    font-size: 38px;
    font-weight: 400;
    color: var(--color-text-heading);
    text-align: right;
    word-break: break-all;
    line-height: 1.1;
}

.wtvat__results {
    background: #f8f9fa;
    border: 1px solid #e0e3e6;
    border-radius: var(--radius-small);
    padding: 6px 12px;
    margin-bottom: 8px;
}

.wtvat__result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 14px;
    gap: 6px;
}

.wtvat__result-row + .wtvat__result-row { border-top: 1px solid #e0e3e6; }

.wtvat__result-label { color: var(--color-text-light); flex-shrink: 0; }

.wtvat__result-value-wrap { display: flex; align-items: center; gap: 6px; }

.wtvat__result-value { font-weight: 600; color: var(--color-text-heading); font-size: 20px; }

.wtvat__copy-btn {
    background: none;
    border: none;
    padding: 3px;
    cursor: pointer;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

.wtvat__copy-btn:hover { color: var(--color-primary); background: rgba(32,116,164,0.08); }
.wtvat__copy-btn--copied { color: #1a7a42 !important; transition: color 0s; }

.wtvat__copy-feedback {
    font-size: 11px;
    color: #1a7a42;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.wtvat__pad { margin-bottom: 8px; }

.wtvat__zero { grid-column: span 4; }

.wtvat__rates, .wtvat__actions { display: flex; gap: 6px; margin-bottom: 8px; }

.wtvat__rate-btn {
    flex: 1;
    height: 36px;
    border: 1px solid #d0d3d7;
    border-radius: var(--radius-small);
    background: #f0f1f3;
    color: var(--color-text-heading);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-family);
    transition: background 0.1s;
}

.wtvat__rate-btn:hover:not(.wtvat__rate-btn--active) { background: #e2e4e8; }

.wtvat__rate-btn--active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

.wtvat__action-btn {
    flex: 1;
    height: 38px;
    border: none;
    border-radius: var(--radius-small);
    background: var(--color-primary);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family);
    transition: background 0.1s;
}

.wtvat__action-btn:hover { background: #1a5f87; }

/* ── QR Code Generator ───────────────────────────────── */

.wtqr__input-row { display: flex; gap: 6px; margin-bottom: 5px; }

.wtqr__input {
    flex: 1;
    padding: 12px 10px;
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-small);
    font-size: 14px;
    font-family: var(--font-family);
    color: var(--color-text-heading);
    outline: none;
    min-width: 0;
}

.wtqr__input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(32,116,164,0.12); }

.wtqr__input--error {
    border-color: #c0392b;
    animation: wtqr-shake 0.35s ease;
}

@keyframes wtqr-shake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-5px); }
    60%     { transform: translateX(5px); }
}

.wtqr__paste-btn {
    background: #ffffff;
    border: 1px solid #d0d3d7;
    border-radius: var(--radius-small);
    padding: 0 10px;
    height: 46px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--color-text-heading);
    transition: background 0.1s;
    flex-shrink: 0;
}

.wtqr__paste-btn:hover { background: #f0f1f3; }

.wtqr__tip { font-size: 12px; color: #b8bcc2; margin-bottom: 8px; }

.wtqr__row { display: flex; gap: 8px; margin-bottom: 8px; }

.wtqr__toggle {
    display: flex;
    border: 1px solid #d0d3d7;
    border-radius: var(--radius-small);
    overflow: hidden;
    flex: 1;
}

.wtqr__toggle-btn {
    flex: 1;
    height: 40px;
    border: none;
    border-right: 1px solid #d0d3d7;
    background: #ffffff;
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font-family);
    color: var(--color-text-heading);
    transition: background 0.1s;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wtqr__toggle-btn:last-child { border-right: none; }

.wtqr__toggle-btn--active {
    background: var(--color-primary);
    color: #ffffff;
}

.wtqr__color-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; margin-bottom: 10px; }

.wtqr__color-swatch {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-small);
    border: 1px solid #d0d3d7;
    cursor: pointer;
    flex-shrink: 0;
}

.wtqr__color-input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }

.wtqr__color-btn {
    flex: none;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d0d3d7;
    border-radius: var(--radius-small);
    background: #ffffff;
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font-family);
    color: var(--color-text-heading);
    transition: background 0.1s;
}

.wtqr__color-btn:hover { background: #f0f1f3; }

.wtqr__generate-btn {
    flex: 1;
    height: 40px;
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-small);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.05em;
    font-family: var(--font-family);
    transition: background 0.1s;
}

.wtqr__generate-btn:hover { background: #1a5f87; }

.wtqr__preview { display: flex; justify-content: center; min-height: 50px; }

.wtqr__preview-inner {
    background: #ffffff;
    border: 1px solid #d0d3d7;
    border-radius: var(--radius-small);
    padding: 8px;
    display: inline-flex;
}

.wtqr__preview-placeholder {
    width: 220px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-light);
    font-size: 13px;
    text-align: center;
}

.wtqr__download-btn {
    width: 100%;
    height: 36px;
    background: #f0f1f3;
    border: 1px solid #d0d3d7;
    border-radius: var(--radius-small);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family);
    color: var(--color-text-heading);
    margin-top: 8px;
    transition: background 0.1s;
}

.wtqr__download-btn:hover { background: #e2e4e8; }

/* ── Case Converter & Word Counter shared ────────────── */

.wtcase__textarea-wrap,
.wtwords__textarea-wrap { position: relative; margin-bottom: 8px; }

.wtcase__textarea,
.wtwords__textarea {
    width: 100%;
    min-height: 165px;
    padding: 8px 34px 8px 10px;
    border: 1px solid var(--color-border-card);
    border-radius: var(--radius-small);
    font-size: 15px;
    font-family: var(--font-family);
    color: var(--color-text-heading);
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    line-height: 1.5;
}

.wtcase__textarea:focus,
.wtwords__textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(32,116,164,0.12);
}

.wtcase__copy-btn,
.wtwords__copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255,255,255,0.92);
    border: 1px solid #d0d3d7;
    border-radius: 4px;
    padding: 3px 5px;
    cursor: pointer;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    transition: color 0.15s, border-color 0.15s;
}

.wtcase__copy-btn:hover,
.wtwords__copy-btn:hover { color: var(--color-primary); border-color: var(--color-primary); }

/* ── Case Converter ──────────────────────────────────── */

.wtcase__buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.wtcase__btn {
    height: 36px;
    border: 1px solid #d0d3d7;
    border-radius: var(--radius-small);
    background: #f0f1f3;
    font-size: 14px;
    cursor: pointer;
    font-family: var(--font-family);
    color: var(--color-text-heading);
    font-weight: 500;
    transition: background 0.1s;
}

.wtcase__btn:hover { background: #e2e4e8; }
.wtcase__btn--active { background: var(--color-primary); border-color: var(--color-primary); color: #ffffff; }

/* ── Word Counter ────────────────────────────────────── */

.wtwords__stats {
    background: #f8f9fa;
    border: 1px solid #e0e3e6;
    border-radius: var(--radius-small);
    padding: 6px 12px;
}

.wtwords__stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 15px;
}

.wtwords__stat + .wtwords__stat { border-top: 1px solid #e0e3e6; }

.wtwords__stat-label { color: var(--color-text-body); }

.wtwords__stat-value {
    font-weight: 700;
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
    min-width: 40px;
    text-align: right;
}
