/* Cancellations tab styles
   Matches the visual language of changebillingcycle.css and
   billingadjustments.css: cards, alerts, light typography. No
   inline styles in the template, all layout lives here. */


/* ========================================
   STATE WRAPPERS
   The two states (existing-request panel vs new-request form) are
   both rendered in the markup; JS toggles which is visible.
   ======================================== */

.cancel-state {
    display: none;
}

.cancel-state--visible {
    display: block;
}


/* ========================================
   PENDING CANCELLATION PANEL
   Shown when tblcancelrequests already has a row for this service.
   ======================================== */

.cancel-pending-card {
    margin-bottom: 20px;
}

.cancel-pending-card .card__body {
    padding: 24px;
}

.cancel-pending-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.cancel-pending-stat__label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 4px;
}

.cancel-pending-stat__value {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
}

.cancel-pending-reason {
    margin-top: 20px;
    padding: 14px 16px;
    background: #f9fafb;
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
}

.cancel-pending-reason__label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 6px;
}

.cancel-pending-reason__value {
    font-size: 14px;
    color: #374151;
    white-space: pre-wrap;
    word-break: break-word;
}


/* ========================================
   NEW REQUEST FORM
   ======================================== */

.cancel-form-card {
    margin-top: 20px;
}

.cancel-form-card .card__body {
    padding: 24px;
}

.cancel-form-row {
    margin-bottom: 18px;
}

.cancel-form-row:last-child {
    margin-bottom: 0;
}

/* The #vpsmanagement scope on productdetails.css forces label{width:5em}
   and input/select/textarea{width:auto !important}; mirror the selectors
   here with a stronger #vpsmanagement-prefixed scope so the row labels
   span the full row and the controls fill the card body. */
#vpsmanagement .cancel-form-row label.cancel-form-row__label {
    display: block;
    width: 100%;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

#vpsmanagement .cancel-form-row select,
#vpsmanagement .cancel-form-row textarea {
    width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-family: inherit;
    background: #ffffff;
    box-sizing: border-box;
}

.cancel-form-row select:focus,
.cancel-form-row textarea:focus {
    outline: none;
    border-color: #67a552;
    box-shadow: 0 0 0 3px rgba(103, 165, 82, 0.12);
}

.cancel-form-row textarea {
    min-height: 90px;
    resize: vertical;
}


/* ========================================
   TYPE SELECTOR (Immediate vs End of Billing)
   Two clickable cards instead of bare radio buttons.
   ======================================== */

.cancel-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

/* Each card is itself a <label>, so the inherited #vpsmanagement label
   rule (width: 5em) collapses it. Re-scope here with #vpsmanagement to
   beat that specificity and force full-cell width. */
#vpsmanagement .cancel-type-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    width: 100%;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.cancel-type-card:hover {
    border-color: #67a552;
    box-shadow: 0 4px 12px rgba(103, 165, 82, 0.1);
}

.cancel-type-card--selected {
    border-color: #67a552;
    background: rgba(103, 165, 82, 0.04);
    box-shadow: 0 4px 12px rgba(103, 165, 82, 0.15);
}

.cancel-type-card__icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: rgba(103, 165, 82, 0.12);
    color: #67a552;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.cancel-type-card--immediate .cancel-type-card__icon {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

/* Make the inner span (parent of __title and __desc) a real column so
   the title and description stack on separate lines instead of running
   together on one. Uses the existing markup from cancellations.tpl
   where the wrapping <span> is the only direct sibling of __icon. */
.cancel-type-card > span:not(.cancel-type-card__icon) {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.cancel-type-card__title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.cancel-type-card__desc {
    display: block;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
}

.cancel-type-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}


/* ========================================
   DOMAIN CANCEL CHECKBOX BLOCK
   ======================================== */

.cancel-domain-block {
    margin-top: 18px;
    padding: 14px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
}

.cancel-domain-block__heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: #92400e;
    font-weight: 600;
}

.cancel-domain-block p {
    font-size: 13px;
    color: #78350f;
    margin: 0 0 8px 0;
}

.cancel-domain-block__check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1f2937;
    cursor: pointer;
}


/* ========================================
   FOOTER ACTIONS
   ======================================== */

.cancel-actions {
    margin-top: 22px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.cancel-actions__spacer {
    flex: 1;
}


/* ========================================
   STATUS MESSAGE INSERTION POINT
   JS pushes alerts into here after AJAX responses.
   ======================================== */

#cancelStatus:empty {
    display: none;
}

#cancelStatus {
    margin-bottom: 16px;
}


/* ========================================
   CONFIRMATION MODAL
   Standalone (not jQuery UI) -- matches the rest of the modern
   client-area look. Backdrop + centered card.
   ======================================== */

.cancel-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.cancel-modal--open {
    display: flex;
}

.cancel-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.cancel-modal__panel {
    position: relative;
    width: 100%;
    max-width: 520px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    margin: 16px;
}

.cancel-modal__header {
    padding: 18px 22px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cancel-modal__header h3 {
    font-size: 17px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.cancel-modal__header i {
    color: #ef4444;
    font-size: 20px;
}

.cancel-modal__body {
    padding: 22px;
    color: #374151;
    font-size: 14px;
    line-height: 1.6;
}

.cancel-modal__body p {
    margin: 0 0 12px 0;
}

.cancel-modal__body p:last-child {
    margin-bottom: 0;
}

.cancel-modal__footer {
    padding: 16px 22px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}


/* ========================================
   SPINNER (used on submit/revoke buttons)
   ======================================== */

.cancel-btn-spinner {
    display: inline-block;
    margin-right: 6px;
}


@media (max-width: 767px) {
    .cancel-pending-grid {
        grid-template-columns: 1fr;
    }
    .cancel-type-grid {
        grid-template-columns: 1fr;
    }
    .cancel-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .cancel-actions__spacer {
        display: none;
    }
}
