/**
 * Front-end design system for the crane rental panels.
 * Mobile-first, RTL, no external dependencies.
 */

.cot-panel {
    --cot-primary: #0f4c5c;
    --cot-primary-dark: #0b3743;
    --cot-accent: #d97706;
    --cot-ink: #182230;
    --cot-muted: #667085;
    --cot-line: #e4e7ec;
    --cot-bg: #f4f6f8;
    --cot-success: #067647;
    --cot-danger: #b42318;
    --cot-warning: #b54708;
    --cot-info: #175cd3;
    --cot-radius: 14px;
    direction: rtl;
    text-align: right;
    color: var(--cot-ink);
    font-family: Vazirmatn, IRANSans, "Segoe UI", Tahoma, sans-serif;
    font-size: 15px;
    line-height: 1.8;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 14px 48px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.cot-panel *,
.cot-panel *::before,
.cot-panel *::after {
    box-sizing: border-box;
}

.cot-panel [hidden],
.cot-stepper [hidden],
.cot-panel .cot-btn[hidden] {
    display: none !important;
}

.cot-panel a {
    color: var(--cot-primary);
    text-decoration: none;
}

.cot-panel a:hover {
    color: var(--cot-accent);
}

.cot-panel img {
    max-width: 100%;
    height: auto;
}

.cot-muted {
    color: var(--cot-muted);
    font-size: 0.9em;
}

.cot-success-text { color: var(--cot-success); font-weight: 700; }
.cot-danger-text { color: var(--cot-danger); font-weight: 700; }

.cot-page-head,
.cot-panel-head {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.cot-page-head h1,
.cot-panel-head h1 {
    font-size: 1.5rem;
    line-height: 1.4;
    margin: 0 0 4px;
    color: var(--cot-primary-dark);
}

.cot-page-head p,
.cot-panel-head p {
    margin: 0;
    color: var(--cot-muted);
}

.cot-panel-head__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Cards ------------------------------------------------------------------ */
.cot-card {
    background: #fff;
    border: 1px solid var(--cot-line);
    border-radius: var(--cot-radius);
    box-shadow: 0 6px 18px rgba(16, 24, 40, 0.04);
    margin-bottom: 18px;
    overflow: hidden;
}

.cot-card__head {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--cot-line);
    background: #fbfcfd;
}

.cot-card__head h2,
.cot-card__head h3 {
    margin: 0;
    font-size: 1.08rem;
    color: var(--cot-primary-dark);
}

.cot-card__body {
    padding: 18px;
}

.cot-two-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.cot-two-col > .cot-card {
    margin-bottom: 0;
}

/* Buttons ---------------------------------------------------------------- */
.cot-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 8px 18px;
    border: 1px solid var(--cot-line);
    border-radius: 10px;
    background: #fff;
    color: var(--cot-ink) !important;
    font: inherit;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.cot-btn:hover {
    border-color: var(--cot-primary);
    background: #f8fafb;
}

.cot-btn--primary {
    background: var(--cot-primary);
    border-color: var(--cot-primary);
    color: #fff !important;
}

.cot-btn--primary:hover {
    background: var(--cot-primary-dark);
    border-color: var(--cot-primary-dark);
}

.cot-btn--ghost {
    background: transparent;
}

.cot-btn--small {
    min-height: 34px;
    padding: 4px 12px;
    font-size: 0.88rem;
    border-radius: 8px;
}

.cot-btn--danger {
    color: var(--cot-danger) !important;
    border-color: #fda29b;
}

.cot-btn[disabled],
.cot-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.cot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Forms ------------------------------------------------------------------ */
.cot-form {
    display: block;
}

.cot-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    min-width: 0;
}

.cot-grid > * {
    min-width: 0;
}

.cot-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    min-width: 0;
}

.cot-field > span,
.cot-label {
    font-weight: 600;
    font-size: 0.92rem;
    color: #344054;
}

.cot-field em {
    color: var(--cot-danger);
    font-style: normal;
}

.cot-field input[type="text"],
.cot-field input[type="email"],
.cot-field input[type="tel"],
.cot-field input[type="number"],
.cot-field input[type="search"],
.cot-field input[type="time"],
.cot-field input[type="file"],
.cot-field select,
.cot-field textarea {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background: #fff;
    color: var(--cot-ink);
    font: inherit;
    line-height: 1.6;
}

.cot-field textarea {
    min-height: 96px;
    resize: vertical;
}

.cot-field input:focus,
.cot-field select:focus,
.cot-field textarea:focus {
    outline: 2px solid rgba(15, 76, 92, 0.18);
    border-color: var(--cot-primary);
}

.cot-input-suffix {
    display: flex;
    align-items: stretch;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.cot-input-suffix input {
    border: 0 !important;
    border-radius: 0 !important;
    flex: 1;
}

.cot-input-suffix span {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: #f2f4f7;
    border-right: 1px solid #d0d5dd;
    font-size: 0.9rem;
    color: var(--cot-muted);
}

.cot-radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cot-radio,
.cot-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--cot-line);
    border-radius: 10px;
    background: #fbfcfd;
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 8px;
}

.cot-radio input,
.cot-checkbox input {
    margin-top: 4px;
    accent-color: var(--cot-primary);
}

.cot-radio--block {
    width: 100%;
}

.cot-subfield {
    padding: 10px 14px;
    border-right: 3px solid var(--cot-line);
    margin: 0 0 12px 0;
}

.cot-hp {
    position: absolute !important;
    right: -10000px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* Alerts ----------------------------------------------------------------- */
.cot-alert {
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    margin: 0 0 16px;
    background: #f2f4f7;
    color: var(--cot-ink);
}

.cot-alert--success { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.cot-alert--error   { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.cot-alert--warning { background: #fffaeb; border-color: #fedf89; color: #b54708; }
.cot-alert--info    { background: #eff8ff; border-color: #b2ddff; color: #175cd3; }

/* Badges ----------------------------------------------------------------- */
.cot-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.7;
    background: #f2f4f7;
    color: #475467;
    white-space: nowrap;
}

.cot-badge--success { background: #ecfdf3; color: #067647; }
.cot-badge--danger  { background: #fef3f2; color: #b42318; }
.cot-badge--warning { background: #fffaeb; color: #b54708; }
.cot-badge--info    { background: #eff8ff; color: #175cd3; }
.cot-badge--brand   { background: #eef4ff; color: #3538cd; }

/* Stats ------------------------------------------------------------------ */
.cot-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.cot-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--cot-line);
    border-radius: 12px;
    border-top: 3px solid var(--cot-primary);
}

.cot-stat--success { border-top-color: var(--cot-success); }
.cot-stat--warning { border-top-color: var(--cot-warning); }
.cot-stat--danger  { border-top-color: var(--cot-danger); }

.cot-stat__value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--cot-primary-dark);
    word-break: break-word;
}

.cot-stat__label {
    color: var(--cot-muted);
    font-size: 0.85rem;
}

/* Tabs ------------------------------------------------------------------- */
.cot-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    margin: 0 0 18px;
    scrollbar-width: thin;
    max-width: 100%;
}

.cot-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    padding: 9px 14px;
    border: 1px solid var(--cot-line);
    border-radius: 999px;
    background: #fff;
    color: #475467 !important;
    font-weight: 600;
    font-size: 0.9rem;
}

.cot-tabs a.is-active {
    background: var(--cot-primary);
    border-color: var(--cot-primary);
    color: #fff !important;
}

.cot-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--cot-accent);
    color: #fff;
    font-size: 0.72rem;
}

/* Stepper ---------------------------------------------------------------- */
.cot-steps {
    display: flex;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
    overflow-x: auto;
}

.cot-steps li {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    padding: 7px 11px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--cot-line);
    color: var(--cot-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.cot-steps li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #f2f4f7;
    font-size: 0.76rem;
}

.cot-steps li.is-active {
    border-color: var(--cot-primary);
    color: var(--cot-primary);
    background: #eef7f8;
}

.cot-steps li.is-active span,
.cot-steps li.is-done span {
    background: var(--cot-primary);
    color: #fff;
}

.cot-steps li.is-done {
    color: var(--cot-success);
    border-color: #abefc6;
}

.cot-stepper.is-enhanced .cot-step {
    display: none;
}

.cot-stepper.is-enhanced .cot-step.is-active {
    display: block;
}

.cot-step {
    border: 0;
    padding: 0;
    margin: 0;
    min-inline-size: 0;
    min-width: 0;
    max-width: 100%;
}

.cot-step > * {
    max-width: 100%;
}

.cot-step legend {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--cot-primary-dark);
    margin-bottom: 14px;
    padding: 0;
}

.cot-stepper__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--cot-line);
}

.cot-form-errors {
    padding: 12px 16px;
    border-radius: 10px;
    background: #fef3f2;
    border: 1px solid #fecdca;
    color: #b42318;
    margin-top: 12px;
}

.cot-form-errors p {
    margin: 0 0 6px;
}

/* Quote and summary ------------------------------------------------------ */
.cot-quote-box {
    background: linear-gradient(135deg, #f0f8f9, #fbfcfd);
    border: 1px solid #cfe5e8;
    border-radius: 12px;
    padding: 14px 16px;
    margin-top: 16px;
}

.cot-quote-box.is-loading {
    opacity: 0.7;
}

.cot-quote-box__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px dashed #d6e6e9;
}

.cot-quote-box__row:last-child {
    border-bottom: 0;
}

.cot-quote-box__row strong {
    color: var(--cot-primary-dark);
    text-align: left;
}

.cot-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    border: 1px solid var(--cot-line);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.cot-summary > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border-bottom: 1px solid var(--cot-line);
}

.cot-summary > div:nth-child(even) {
    background: #fbfcfd;
}

.cot-summary > div:last-child {
    border-bottom: 0;
}

/* Map -------------------------------------------------------------------- */
.cot-map-wrap {
    margin-top: 14px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--cot-line);
}

.cot-map {
    height: 280px;
    width: 100%;
    background: #e5e7eb;
    z-index: 1;
}

.cot-map__hint {
    font-size: 0.85rem;
    color: var(--cot-muted);
    margin-top: 8px;
}

.cot-map__hint.is-set {
    color: var(--cot-success);
    font-weight: 600;
}

.cot-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.cot-inline-actions input {
    flex: 1 1 180px;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    font: inherit;
}

.cot-search-results {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    max-height: 220px;
    overflow-y: auto;
}

.cot-search-result {
    padding: 9px 12px;
    border: 1px solid var(--cot-line);
    border-radius: 9px;
    background: #fff;
    text-align: right;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.cot-search-result:hover {
    border-color: var(--cot-primary);
    background: #f8fafb;
}

/* Tables ----------------------------------------------------------------- */
.cot-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--cot-line);
}

.cot-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.88rem;
}

.cot-table th,
.cot-table td {
    padding: 10px 11px;
    border-bottom: 1px solid var(--cot-line);
    text-align: right;
    vertical-align: middle;
}

.cot-table thead th {
    background: #f8fafb;
    color: #475467;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.cot-table tbody tr:last-child td {
    border-bottom: 0;
}

.cot-table tbody tr:hover {
    background: #fcfdfe;
}

.cot-kv {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.cot-kv th,
.cot-kv td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--cot-line);
    text-align: right;
    vertical-align: top;
}

.cot-kv th {
    width: 36%;
    color: var(--cot-muted);
    font-weight: 600;
}

.cot-kv tr:last-child th,
.cot-kv tr:last-child td {
    border-bottom: 0;
}

/* Lists ------------------------------------------------------------------ */
.cot-mini-list {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
}

.cot-mini-list li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--cot-line);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.cot-mini-list li:last-child {
    border-bottom: 0;
}

.cot-timeline {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cot-timeline li {
    position: relative;
    padding: 0 18px 14px 0;
    border-right: 2px solid var(--cot-line);
    margin-right: 4px;
}

.cot-timeline li:last-child {
    border-right-color: transparent;
    padding-bottom: 0;
}

.cot-timeline li::before {
    content: "";
    position: absolute;
    right: -5px;
    top: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cot-primary);
}

.cot-timeline strong {
    display: block;
    font-size: 0.92rem;
}

.cot-timeline small {
    display: block;
    color: var(--cot-muted);
    font-size: 0.78rem;
}

/* Content ---------------------------------------------------------------- */
.cot-agreement-content {
    border: 1px solid var(--cot-line);
    border-radius: 12px;
    padding: 16px;
    background: #fbfcfd;
    margin: 14px 0;
    line-height: 2;
}

.cot-agreement-content p {
    margin: 0 0 10px;
}

.cot-crane-summary {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.cot-crane-summary__image img {
    width: 100%;
    max-width: 190px;
    border-radius: 12px;
    display: block;
}

.cot-crane-summary h3 {
    margin: 0 0 4px;
    color: var(--cot-primary-dark);
}

.cot-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.cot-gallery-grid img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--cot-line);
}

.cot-auth-card {
    max-width: 520px;
    margin: 24px auto;
    text-align: center;
}

.cot-auth-card .cot-actions {
    justify-content: center;
}

/* Buttons must beat the parent theme's attribute-specificity reset. */
.cot-panel .cot-btn,
.cot-panel .cot-btn:link,
.cot-panel .cot-btn:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 8px 18px;
    border: 1px solid var(--cot-line);
    border-radius: 10px;
    background: #fff;
    color: var(--cot-ink) !important;
    font: inherit;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    white-space: normal;
    cursor: pointer;
}

.cot-panel .cot-btn:hover,
.cot-panel .cot-btn:focus {
    border-color: var(--cot-primary);
    background: #f8fafb;
    color: var(--cot-primary-dark) !important;
}

.cot-panel .cot-btn--primary,
.cot-panel .cot-btn--primary:link,
.cot-panel .cot-btn--primary:visited {
    background: var(--cot-primary);
    border-color: var(--cot-primary);
    color: #fff !important;
}

.cot-panel .cot-btn--primary:hover,
.cot-panel .cot-btn--primary:focus {
    background: var(--cot-primary-dark);
    border-color: var(--cot-primary-dark);
    color: #fff !important;
}

.cot-panel .cot-btn--ghost {
    background: transparent;
}

.cot-panel .cot-btn--ghost:hover {
    background: #f8fafb;
}

.cot-panel .cot-btn--danger {
    background: #fff;
    border-color: #fda29b;
    color: var(--cot-danger) !important;
}

.cot-panel .cot-btn--danger:hover {
    background: #fef3f2;
    color: var(--cot-danger) !important;
}

.cot-panel .cot-btn--small {
    min-height: 34px;
    padding: 4px 12px;
    font-size: 0.88rem;
    border-radius: 8px;
}

.cot-panel .cot-btn[hidden] {
    display: none !important;
}

/* Admin bar / theme spacing fallback */
.cot-panel .cot-card:last-child {
    margin-bottom: 0;
}

/* Legacy Aparat embed helper kept from the original child theme. */
.h_iframe-aparat_embed_frame {
    position: relative;
}

.h_iframe-aparat_embed_frame .ratio {
    display: block;
    width: 100%;
    height: auto;
}

.h_iframe-aparat_embed_frame iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.h_iframe-aparat_embed_frame > span {
    display: block;
    padding-top: 57%;
}


/* Tablet ----------------------------------------------------------------- */
@media (min-width: 640px) {
    .cot-panel {
        padding: 24px 20px 60px;
        font-size: 15px;
    }

    .cot-grid--2,
    .cot-two-col {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cot-grid--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .cot-grid--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cot-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .cot-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cot-summary > div:nth-child(even) {
        background: #fff;
    }

    .cot-summary > div:nth-child(4n+2),
    .cot-summary > div:nth-child(4n+3) {
        background: #fbfcfd;
    }

    .cot-page-head,
    .cot-panel-head {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .cot-map {
        height: 330px;
    }

    .cot-crane-summary {
        flex-direction: row;
        align-items: flex-start;
    }

    .cot-gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Desktop ---------------------------------------------------------------- */
@media (min-width: 1024px) {
    .cot-stat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .cot-grid--4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .cot-panel {
        padding: 30px 24px 70px;
    }

    .cot-page-head h1,
    .cot-panel-head h1 {
        font-size: 1.8rem;
    }

    .cot-summary {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .cot-summary > div:nth-child(even),
    .cot-summary > div:nth-child(4n+2),
    .cot-summary > div:nth-child(4n+3) {
        background: #fff;
    }

    .cot-summary > div:nth-child(4n+1) {
        background: #fbfcfd;
    }
}

/* Mobile table cards ----------------------------------------------------- */
@media (max-width: 767px) {
    .cot-table thead {
        display: none;
    }

    .cot-table,
    .cot-table tbody,
    .cot-table tr,
    .cot-table td {
        display: block;
        width: 100%;
    }

    .cot-table tr {
        border-bottom: 6px solid var(--cot-bg);
        padding: 4px 0;
    }

    .cot-table td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        border-bottom: 1px dashed var(--cot-line);
        padding: 8px 12px;
        text-align: left;
    }

    .cot-table td:last-child {
        border-bottom: 0;
    }

    .cot-table td::before {
        content: attr(data-label);
        color: var(--cot-muted);
        font-weight: 600;
        font-size: 0.8rem;
        text-align: right;
        flex: 0 0 40%;
    }

    .cot-kv th {
        width: 42%;
    }

    .cot-stepper__nav {
        position: sticky;
        bottom: 0;
        background: #fff;
        z-index: 5;
        padding-bottom: 10px;
        box-shadow: 0 -6px 14px rgba(16, 24, 40, 0.06);
    }

    .cot-stepper__nav .cot-btn {
        flex: 1;
    }
}
