/*
 * Garantiform – Public CSS
 * Hand-compiled Tailwind-compatible styles for the guarantee registration form.
 * RTL (Persian) layout.
 *
 * @package Garantiform
 */

/* ─── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.gf-wrap {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    font-size: 14px;
    color: #1f2937;
    direction: rtl;
    line-height: 1.6;
}

/* ─── Card ──────────────────────────────────────────────────────────────── */
.gf-card {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    padding: 2rem;
    max-width: 860px;
    margin: 2rem auto;
}

.gf-card__header { margin-bottom: 1.5rem; border-bottom: 2px solid #f3f4f6; padding-bottom: 1rem; }
.gf-card__title  { font-size: 1.4rem; font-weight: 700; color: #111827; }
.gf-card__subtitle { font-size: .9rem; color: #6b7280; margin-top: .25rem; }

/* ─── Steps ─────────────────────────────────────────────────────────────── */
.gf-step { animation: gf-fadein .3s ease; }
.gf-step--active {}
@keyframes gf-fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ─── Fieldset / Legend ──────────────────────────────────────────────────── */
.gf-fieldset { border: 1px solid #e5e7eb; border-radius: .75rem; padding: 1.25rem; margin-bottom: 1.25rem; }
.gf-legend    { font-weight: 600; font-size: .95rem; color: #374151; padding: 0 .5rem; }

/* ─── Grid ──────────────────────────────────────────────────────────────── */
.gf-grid       { display: grid; gap: 1rem; }
.gf-grid--2    { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 600px) { .gf-grid--2 { grid-template-columns: 1fr; } }

/* ─── Form fields ───────────────────────────────────────────────────────── */
.gf-field { display: flex; flex-direction: column; gap: .35rem; }
.gf-field--invoice-price { margin-top: .25rem; }

.gf-label {
    font-size: .88rem;
    font-weight: 600;
    color: #374151;
}
.gf-required { color: #ef4444; }

.gf-field-desc {
    font-size: .8rem;
    line-height: 1.65;
    color: #6b7280;
    margin: .15rem 0 0;
}

/* ─── Inline alert (Tailwind-style) ─────────────────────────────────────── */
.gf-alert {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    border-radius: .75rem;
    padding: .75rem .9rem;
    margin-top: .5rem;
    font-size: .84rem;
    line-height: 1.7;
}
.gf-alert--warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}
.gf-alert__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.35rem;
    height: 1.35rem;
    margin-top: .1rem;
    border-radius: 9999px;
    background: #fef3c7;
    color: #d97706;
}
.gf-alert__icon-svg {
    width: 1rem;
    height: 1rem;
}
.gf-alert__text {
    margin: 0;
    flex: 1;
}

.gf-input,
.gf-select,
.gf-textarea {
    width: 100%;
    padding: .7rem 1rem;
    font-family: inherit;
    font-size: .95rem;
    color: #111827;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: .75rem;
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
    appearance: none;
    -webkit-appearance: none;
    line-height: 1.5;
}
.gf-input:hover,
.gf-select:hover { border-color: #a5b4fc; background: #fafafe; }
.gf-input:focus,
.gf-select:focus,
.gf-textarea:focus {
    border-color: #6366f1;
    background: #fafafe;
    box-shadow: 0 0 0 3px rgba(99,102,241,.14);
}
.gf-input::placeholder { color: #94a3b8; font-size: .9rem; }
.gf-input--error { border-color: #ef4444 !important; background: #fff8f8 !important; box-shadow: 0 0 0 3px rgba(239,68,68,.1) !important; }

/* Custom select with arrow */
.gf-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236366f1'%3E%3Cpath fill-rule='evenodd' d='M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left .75rem center;
    background-size: 1.15rem;
    padding-left: 2.4rem;
    cursor: pointer;
}
.gf-select option { font-family: 'Vazirmatn', Tahoma, Arial, sans-serif; }

/* ─── Searchable select ─────────────────────────────────────────────────── */
.gf-search-select { position: relative; }
.gf-search-select__trigger {
    width: 100%;
    text-align: right;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left .75rem center;
    background-size: 1.1rem;
    padding-left: 2.25rem;
}
.gf-search-select__trigger--placeholder { color: #9ca3af; }
.gf-search-select--open .gf-search-select__trigger {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.gf-search-select__dropdown {
    position: absolute;
    z-index: 40;
    top: calc(100% + .35rem);
    right: 0;
    left: 0;
    max-height: 260px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #c7d2fe;
    border-radius: .65rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.gf-search-select__filter {
    margin: .5rem;
    flex-shrink: 0;
}
.gf-search-select__list {
    overflow-y: auto;
    max-height: 200px;
}
.gf-search-select__option {
    display: block;
    width: 100%;
    padding: .55rem .75rem;
    border: 0;
    background: transparent;
    text-align: right;
    font-family: inherit;
    font-size: .9rem;
    color: #1f2937;
    cursor: pointer;
}
.gf-search-select__option:hover,
.gf-search-select__option--selected { background: #eef2ff; color: #3730a3; }
.gf-search-select__empty {
    padding: .75rem;
    color: #6b7280;
    font-size: .85rem;
    text-align: center;
}


/* Price input with currency label */
.gf-input-price-wrap { position: relative; }
.gf-input-price-wrap .gf-input { padding-left: 3.8rem; }
.gf-input-price-wrap::after {
    content: 'تومان';
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .78rem;
    font-weight: 600;
    color: #6366f1;
    pointer-events: none;
    background: #eef2ff;
    padding: .1rem .35rem;
    border-radius: .3rem;
}

.gf-error-msg { font-size: .8rem; color: #ef4444; min-height: 1rem; margin-top: .1rem; }

/* ─── Item row ──────────────────────────────────────────────────────────── */
.gf-item-row {
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: .75rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    position: relative;
}
.gf-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.gf-item-number { font-size: .9rem; font-weight: 600; color: #475569; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.gf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1.2rem;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    border-radius: .5rem;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    position: relative;
    white-space: nowrap;
}
.gf-btn:disabled { opacity: .65; cursor: not-allowed; }

.gf-btn--primary  { background: #6366f1; color: #fff; border-color: #6366f1; }
.gf-btn--primary:hover:not(:disabled) { background: #4f46e5; border-color: #4f46e5; }

.gf-btn--secondary { background: #0ea5e9; color: #fff; border-color: #0ea5e9; }
.gf-btn--secondary:hover:not(:disabled) { background: #0284c7; }

.gf-btn--danger   { background: #ef4444; color: #fff; border-color: #ef4444; }
.gf-btn--danger:hover:not(:disabled) { background: #dc2626; }

.gf-btn--outline  { background: transparent; color: #6366f1; border-color: #6366f1; }
.gf-btn--outline:hover:not(:disabled) { background: #eef2ff; }

.gf-btn--ghost    { background: transparent; color: #6b7280; border-color: #d1d5db; }
.gf-btn--ghost:hover:not(:disabled) { background: #f3f4f6; }

.gf-btn--lg       { padding: .75rem 1.75rem; font-size: 1rem; border-radius: .65rem; }
.gf-btn--sm       { padding: .35rem .75rem; font-size: .82rem; }
.gf-btn--icon     { padding: .4rem; border-radius: .4rem; }

.gf-btn__text  {}
.gf-btn__loader {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gf-spin .6s linear infinite;
    position: absolute;
}
@keyframes gf-spin { to { transform: rotate(360deg); } }

.gf-icon { width: 16px; height: 16px; }

/* ─── Actions ────────────────────────────────────────────────────────────── */
.gf-actions         { margin-top: 1.5rem; display: flex; justify-content: center; }
.gf-actions--spaced { justify-content: space-between; }
.gf-mt-sm           { margin-top: .65rem; }

/* ─── Preview section ────────────────────────────────────────────────────── */
.gf-preview-block        { margin-bottom: 1.5rem; }
.gf-preview-block__title { font-size: 1rem; font-weight: 700; color: #374151; margin-bottom: .75rem; border-right: 3px solid #6366f1; padding-right: .6rem; }

.gf-dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem; font-size: .9rem; }
.gf-dl dt { font-weight: 600; color: #6b7280; white-space: nowrap; }
.gf-dl dd { color: #111827; }

.gf-preview-item {
    display: flex;
    gap: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: .65rem;
    padding: 1rem;
    margin-bottom: .75rem;
}
.gf-preview-item__num {
    background: #6366f1;
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ─── Notice ─────────────────────────────────────────────────────────────── */
.gf-notice {
    border-radius: .6rem;
    padding: .85rem 1.1rem;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.gf-notice--info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.gf-notice--success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.gf-notice--error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }

/* ─── Coupon ─────────────────────────────────────────────────────────────── */
.gf-coupon-box   { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: .65rem; padding: 1rem; margin: 1rem 0; }
.gf-coupon-row   { display: flex; gap: .5rem; margin-top: .4rem; }
.gf-input--coupon { flex: 1; }
.gf-coupon-result { margin-top: .5rem; font-size: .85rem; padding: .5rem .75rem; border-radius: .4rem; }
.gf-coupon-result--success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.gf-coupon-result--error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* ─── Total ──────────────────────────────────────────────────────────────── */
.gf-total-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: .65rem;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}
.gf-total-label  { font-weight: 600; color: #374151; }
.gf-total-amount { font-size: 1.3rem; font-weight: 800; color: #15803d; }

/* ─── Result page ────────────────────────────────────────────────────────── */
.gf-card--result    { text-align: center; }
.gf-result-icon     { font-size: 3rem; margin-bottom: 1rem; }
.gf-result-check    { display: inline-flex; align-items: center; justify-content: center; background: #16a34a; color: #fff; border-radius: 50%; width: 64px; height: 64px; font-size: 2rem; }
.gf-result-x        { display: inline-flex; align-items: center; justify-content: center; background: #dc2626; color: #fff; border-radius: 50%; width: 64px; height: 64px; font-size: 2rem; }
.gf-card--success   { border-top: 4px solid #16a34a; }
.gf-card--failure   { border-top: 4px solid #dc2626; }
.gf-result-title    { font-size: 1.4rem; font-weight: 700; margin-bottom: .6rem; }
.gf-result-message  { color: #6b7280; margin-bottom: 1.5rem; line-height: 1.7; }
.gf-actions--center { justify-content: center; }
.gf-gap             { gap: .75rem; }

/* ─── Payment Gateways ───────────────────────────────────────────────────── */
.gf-gateways-section { margin-top: 1.25rem; }
.gf-gateways-list    { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .75rem; }
.gf-loading-gateways { color: #6b7280; font-size: .9rem; display: flex; align-items: center; gap: .5rem; }
.gf-spinner-sm       { width: 16px; height: 16px; border: 2px solid #d1d5db; border-top-color: #6366f1; border-radius: 50%; animation: gf-spin .6s linear infinite; }

.gf-gateway-card {
    display: flex;
    align-items: center;
    gap: .6rem;
    border: 2px solid #e2e8f0;
    border-radius: .75rem;
    padding: .65rem 1rem;
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
    background: #fff;
    min-width: 140px;
    user-select: none;
}
.gf-gateway-card:hover { border-color: #a5b4fc; background: #fafafe; }
.gf-gateway-card--selected { border-color: #6366f1; background: #eef2ff; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.gf-gateway-radio { display: none; }
.gf-gateway-info  { display: flex; align-items: center; gap: .5rem; }
.gf-gateway-icon  { height: 24px; width: auto; max-width: 60px; object-fit: contain; }
.gf-gateway-title { font-size: .9rem; font-weight: 600; color: #374151; }

/* ─── Utility ────────────────────────────────────────────────────────────── */
.gf-hidden { display: none !important; }
.gf-ltr    { direction: ltr; text-align: left; }

/* ─── Mobile responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .gf-card {
        padding: 1rem .75rem;
        margin: .75rem auto;
        border-radius: .75rem;
    }
    .gf-card__header { padding-bottom: .75rem; margin-bottom: 1rem; }
    .gf-card__title  { font-size: 1.1rem; }
    .gf-fieldset     { padding: .85rem .65rem; }
    .gf-item-row     { padding: .85rem .65rem; }
    .gf-input,
    .gf-select       { padding: .55rem .75rem; font-size: .9rem; }
    .gf-gateways-list { gap: .5rem; }
    .gf-gateway-card  { min-width: 0; flex: 1 1 calc(50% - .5rem); }
    .gf-coupon-row    { flex-direction: column; }
    .gf-actions--spaced { flex-direction: column-reverse; gap: .5rem; }
    .gf-actions--spaced .gf-btn { width: 100%; justify-content: center; }
    .gf-total-box     { flex-direction: column; gap: .25rem; text-align: center; }
    .gf-total-amount  { font-size: 1.1rem; }
    .gf-preview-item  { flex-direction: column; gap: .5rem; }
    .gf-dl            { font-size: .82rem; }
}

/* ─── Warranty Check shortcode ───────────────────────────────────────────── */
.gf-check-form   { margin-bottom: 1rem; }
.gf-check-row    { display: flex; align-items: flex-end; gap: .75rem; }
.gf-check-btn-wrap { flex-shrink: 0; padding-bottom: 1.2rem; }

.gf-check-results { margin-top: 1.25rem; }
.gf-check-empty   { text-align: center; padding: 2rem 1rem; color: #6b7280; }
.gf-check-empty__icon { font-size: 2.5rem; display: block; margin-bottom: .75rem; }

.gf-check-warranty {
    border: 1.5px solid #e2e8f0;
    border-radius: .75rem;
    margin-bottom: 1rem;
    overflow: hidden;
}
.gf-check-warranty__header {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    padding: .6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    font-size: .88rem;
}
.gf-check-warranty__name { opacity: .95; font-weight: 700; }
.gf-check-warranty__created { opacity: .9; font-size: .82rem; }

.gf-check-devices  { padding: .5rem; display: flex; flex-direction: column; gap: .4rem; }
.gf-check-device {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    background: #f8fafc;
    border-radius: .55rem;
    padding: .55rem .9rem;
    font-size: .88rem;
}
.gf-check-device__info    { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.gf-check-device__type    { color: #6b7280; }
.gf-check-device__model   { color: #374151; font-weight: 600; }
.gf-check-device__status  { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; }
.gf-check-device__date    { font-size: .78rem; color: #9ca3af; }

/* Badges */
.gf-badge {
    display: inline-block;
    font-size: .78rem;
    font-weight: 700;
    padding: .2rem .65rem;
    border-radius: 999px;
}
.gf-badge--active  { background: #dcfce7; color: #15803d; }
.gf-badge--warning { background: #fef9c3; color: #854d0e; }
.gf-badge--expired { background: #fee2e2; color: #dc2626; }

/* Confirm reset modal */
.gf-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gf-confirm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .45);
}
.gf-confirm-modal__box {
    position: relative;
    width: min(92vw, 440px);
    background: #fff;
    border-radius: .9rem;
    padding: 1rem;
    box-shadow: 0 20px 48px rgba(2, 6, 23, .28);
}
.gf-confirm-modal__title { margin: 0 0 .55rem; font-size: 1.02rem; color: #111827; }
.gf-confirm-modal__text  { margin: 0 0 1rem; color: #4b5563; font-size: .92rem; }
.gf-confirm-modal__actions { display: flex; justify-content: flex-end; gap: .5rem; }

@media (max-width: 600px) {
    .gf-check-row   { flex-direction: column; align-items: stretch; }
    .gf-check-btn-wrap { padding-bottom: 0; }
    .gf-check-device { flex-direction: column; align-items: flex-start; }
    .gf-check-device__status { align-items: flex-start; }
}
