/* Billing Pages - Manage Cards, Invoices, etc. */

/* ========================================
   CREDIT CARD FORM STYLING
   ======================================== */

/* Two Column Layout for CC Form */
.product-details {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.04), 0px 8px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid #f3f4f6;
    padding: 30px !important;
    margin-bottom: 30px;
    float: none !important;
}

/* Fix two column layout */
.product-details .col2half {
    width: calc(50% - 10px);
    float: left;
    padding-right: 20px;
}

.product-details .col2half:last-of-type {
    padding-right: 0;
    padding-left: 20px;
}

/* Default controls should be block */
.product-details .control-group .controls {
    display: block;
}

/* ========================================
   RESPONSIVE FORM LAYOUT
   ======================================== */

@media (max-width: 991px) {
    .product-details .col2half {
        width: 100%;
        float: none;
        padding-right: 0;
        padding-left: 0;
        margin-bottom: 20px;
    }

    .product-details .col2half:last-of-type {
        padding-left: 0;
    }
}

@media (max-width: 767px) {
    .product-details {
        padding: 20px !important;
    }
}

/* ========================================
   SPECIFIC FIELDSET FIX
   ======================================== */

/* Nested fieldset.control-group causing layout issues */
.product-details > form > .product-details fieldset.control-group {
    display: block;
    padding: 0;
    margin: 0;
    border: none;
}

.product-details fieldset.control-group {
    display: block;
    padding: 0;
    margin: 0;
    border: none;
}

/* Don't apply flex to wrapper control-group */
.product-details > fieldset.control-group > .control-group {
    display: block;
    margin-bottom: 0;
}

/* ========================================
   CREDIT ROW HIGHLIGHT
   ======================================== */

/* Red highlight for rows that need fixing */
tr.credit {
    background: rgba(239, 68, 68, 0.05) !important;
    border-left: 4px solid #ef4444;
}

tr.credit:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* ========================================
   CREDIT CARD PAYMENT FORM (creditcard.tpl)
   ======================================== */

/* Payment Form Wrapper */
.payment-form-wrapper {
    margin-bottom: 30px;
}

/* Two Column Grid for Billing Info & Card Details */
.payment-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

/* Payment Section Card */
.payment-section {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.04), 0px 8px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid #f3f4f6;
    overflow: hidden;
}

.payment-section__header {
    padding: 20px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.payment-section__header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.payment-section__header h2 i {
    color: #67a552;
    font-size: 20px;
}

.payment-section__body {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 16px;
}

/* Full width elements in the grid */
.payment-section__body > .saved-cards-selector,
.payment-section__body > #newcard > .secure-3d-checkbox,
.payment-section__body > #newcard > .no-store-checkbox,
.payment-section__body > input[type="hidden"] {
    grid-column: 1 / -1;
}

/* Specific full-width fields */
.payment-section__body .control-group:has(#address1),
.payment-section__body .control-group:has(#ccnumber),
.payment-section__body .control-group:has(#usecardfor),
.payment-section__body #specificservices {
    grid-column: 1 / -1;
}

/* Make newcard wrapper inherit grid */
#newcard {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 16px;
}

/* Reset control-group margins in grid */
.payment-section__body .control-group,
#newcard .control-group {
    margin-bottom: 0;
}

/* Saved Cards Selector */
.saved-cards-selector {
    margin-bottom: 0;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.saved-cards-selector .control-label {
    margin-bottom: 10px;
    display: block;
}

.saved-cards-selector__content {
    display: flex;
    gap: 12px;
    align-items: center;
}

.saved-cards-selector__content select {
    flex: 1;
}

.saved-cards-selector__content .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Card Date Inputs (Expiry/Start) */
.card-date-inputs {
    display: flex !important;
    align-items: center;
    gap: 12px;
}

.card-date-inputs select {
    flex: 1;
    max-width: 120px;
}

.card-date-inputs .date-separator {
    font-size: 18px;
    font-weight: 600;
    color: #9ca3af;
}

/* CVV Input Group */
.cvv-input-group {
    display: flex !important;
    align-items: center;
    gap: 12px;
}

.cvv-input-group input.input-mini {
    width: 100px !important;
    flex: 0 0 100px;
}

.cvv-help-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #67a552;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.cvv-help-link:hover {
    color: #5a8f47;
    text-decoration: underline;
}

.cvv-help-link i {
    font-size: 14px;
}

/* 3D Secure Checkbox */
.secure-3d-checkbox {
    margin-top: 24px;
    padding: 16px;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.secure-3d-checkbox .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 0;
}

.secure-3d-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.secure-3d-checkbox .checkbox-text {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1f2937;
    font-size: 14px;
}

.secure-3d-checkbox .checkbox-text strong {
    font-weight: 600;
}

.secure-3d-checkbox .checkbox-text .tool {
    color: #3b82f6;
    font-size: 16px;
    text-decoration: none;
}

.secure-3d-checkbox .checkbox-text .tool:hover {
    color: #2563eb;
}

/* No Store Checkbox */
.no-store-checkbox {
    margin-top: 16px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.no-store-checkbox .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    margin: 0;
}

.no-store-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
    margin-top: 2px;
}

.no-store-checkbox .checkbox-text {
    flex: 1;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

/* Payment Submit Section */
.payment-submit {
    display: flex;
    justify-content: flex-end;
    padding: 24px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.payment-submit .btn {
    min-width: 280px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
}

/* Explanation Alert (appears under save card dropdown) */
#explanation {
    display: block !important;
    width: 100%;
    margin-top: 12px;
}

#explanation:empty {
    margin-top: 0;
    display: none !important;
}

#explanation .alert {
    margin-bottom: 0;
    font-size: 13px;
}

/* ========================================
   RESPONSIVE DESIGN - CREDIT CARD FORM
   ======================================== */

@media (max-width: 1200px) {
    .payment-form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 991px) {
    .payment-section__header {
        padding: 16px 20px;
    }

    .payment-section__body {
        padding: 20px;
    }

    .saved-cards-selector__content {
        flex-direction: column;
        align-items: stretch;
    }

    .saved-cards-selector__content .btn {
        width: 100%;
    }
}

@media (max-width: 767px) {
    .payment-section__header h2 {
        font-size: 16px;
    }

    .payment-section__header h2 i {
        font-size: 18px;
    }

    .payment-section__body {
        padding: 16px;
        grid-template-columns: 1fr;
        gap: 16px;
    }

    #newcard {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card-date-inputs {
        flex-wrap: wrap;
    }

    .card-date-inputs select {
        max-width: 100%;
    }

    .cvv-input-group {
        flex-wrap: wrap;
    }

    .cvv-input-group input.input-mini {
        width: 100% !important;
        max-width: 120px;
        flex: 0 0 120px;
    }

    .payment-submit .btn {
        width: 100%;
        min-width: 0;
    }

    .secure-3d-checkbox,
    .no-store-checkbox {
        padding: 12px;
    }
}

@media (max-width: 640px) {
    .payment-submit {
        padding: 16px;
    }

    .saved-cards-selector {
        padding-bottom: 20px;
        margin-bottom: 20px;
    }
}

/* ========================================
   MANAGE CARDS PAGE STYLES
   ======================================== */

/* Services Checkbox List */
.services-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.service-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
}

.service-checkbox-item:hover {
    background: #ffffff;
    border-color: #67a552;
    box-shadow: 0 2px 4px rgba(103, 165, 82, 0.1);
}

.service-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 2px 0 0 0;
    flex-shrink: 0;
}

.service-checkbox-item span {
    flex: 1;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

/* Card Info Grid (for manage services page) */
.card-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 24px;
}

.card-info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-info-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-info-value {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

/* Manage Card Body */
.manage-card-body {
    display: block !important;
}

.manage-renewal-control {
    margin-bottom: 24px;
}

.manage-renewal-control .control-label {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
}

/* Specific Services Section */
#specificservices {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

#specificservices .control-label {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* Payment Submit with Multiple Buttons */
.payment-submit {
    gap: 12px;
}

/* Responsive - Manage Cards */
@media (max-width: 991px) {
    .card-info-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 767px) {
    .service-checkbox-item {
        padding: 10px;
    }

    .service-checkbox-item span {
        font-size: 13px;
    }

    .card-info-grid {
        padding: 16px;
        gap: 12px;
    }
}

/* ========================================
   ADD FUNDS PAGE STYLES
   ======================================== */

/* Funding Limits Grid */
.add-funds-limits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* Individual Limit Card */
.funds-limit-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.04), 0px 8px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

.funds-limit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.04), 0px 12px 48px rgba(0, 0, 0, 0.12);
}

.funds-limit-card__icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(103, 165, 82, 0.1);
    border-radius: 8px;
    flex-shrink: 0;
}

.funds-limit-card__icon i {
    font-size: 24px;
    color: #67a552;
}

.funds-limit-card__content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.funds-limit-card__label {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.funds-limit-card__value {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

/* Add Funds Form Card */
.add-funds-card {
    max-width: 600px;
    margin: 0 auto;
}

.add-funds-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.add-funds-form .control-group {
    margin-bottom: 0;
}

/* Add Funds Notice */
.add-funds-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.add-funds-notice i {
    font-size: 20px;
    color: #f59e0b;
    flex-shrink: 0;
}

.add-funds-notice span {
    font-size: 14px;
    color: #92400e;
    font-weight: 500;
    line-height: 1.5;
}

/* Center footer button */
.add-funds-card .card__footer {
    display: flex;
    justify-content: center;
}

/* Responsive - Add Funds */
@media (max-width: 991px) {
    .add-funds-limits {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 767px) {
    .funds-limit-card {
        padding: 20px;
    }

    .funds-limit-card__icon {
        width: 40px;
        height: 40px;
    }

    .funds-limit-card__icon i {
        font-size: 20px;
    }

    .funds-limit-card__value {
        font-size: 18px;
    }

    .add-funds-notice {
        padding: 12px;
    }

    .add-funds-card .btn {
        width: 100%;
    }
}

/* ========================================
   3D SECURE PAGE STYLES
   ======================================== */

/* 3D Secure Card */
.secure-3d-card {
    max-width: 500px;
    margin: 0 auto;
}

/* 3D Secure iframe */
.secure-3d-iframe {
    width: 100%;
    height: 600px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-top: 20px;
}

/* Responsive - 3D Secure */
@media (max-width: 767px) {
    .secure-3d-iframe {
        height: 500px;
    }
}

/* ========================================
   MASS PAY PAGE STYLES
   ======================================== */

/* Mass Pay Cards */
.masspay-card {
    margin-bottom: 24px;
}

.masspay-payment-card {
    max-width: 600px;
    margin: 0 auto;
}

/* Invoice Groups */
.masspay-invoices {
    padding: 0;
}

.masspay-invoice-group {
    border-bottom: 1px solid #e5e7eb;
}

.masspay-invoice-group:last-child {
    border-bottom: none;
}

.masspay-invoice-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.masspay-invoice-header i {
    color: #67a552;
    font-size: 18px;
}

.masspay-invoice-header strong {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
}

/* Invoice Items */
.masspay-invoice-items {
    padding: 0;
}

.masspay-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 24px;
    border-bottom: 1px solid #f3f4f6;
}

.masspay-item:last-child {
    border-bottom: none;
}

.masspay-item__description {
    flex: 1;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

.masspay-item__amount {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-left: 20px;
}

/* Totals Section */
.masspay-totals {
    padding: 20px 24px;
    background: #f9fafb;
    border-top: 2px solid #e5e7eb;
}

.masspay-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.masspay-total-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.masspay-total-value {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
}

/* Credit Row */
.masspay-total-row--credit .masspay-total-value {
    color: #67a552;
}

/* Final Total Row */
.masspay-total-row--final {
    padding: 16px 0 0 0;
    margin-top: 8px;
    border-top: 2px solid #d1d5db;
}

.masspay-total-row--final .masspay-total-label {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.masspay-total-row--final .masspay-total-value {
    font-size: 20px;
    font-weight: 700;
    color: #67a552;
}

/* Payment Method Options */
.payment-method-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payment-method-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
}

.payment-method-option:hover {
    background: #ffffff;
    border-color: #67a552;
    box-shadow: 0 2px 4px rgba(103, 165, 82, 0.1);
}

.payment-method-option input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.payment-method-option input[type="radio"]:checked ~ .payment-method-option__label {
    color: #1f2937;
    font-weight: 600;
}

.payment-method-option input[type="radio"]:checked ~ .payment-method-option__label i {
    color: #67a552;
}

.payment-method-option__label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: #4b5563;
    flex: 1;
}

.payment-method-option__label i {
    font-size: 18px;
    color: #d1d5db;
    transition: color 0.2s ease;
}

/* Center footer button */
.masspay-payment-card .card__footer {
    display: flex;
    justify-content: center;
}

/* Responsive - Mass Pay */
@media (max-width: 767px) {
    .masspay-invoice-header {
        padding: 16px 20px;
    }

    .masspay-item {
        padding: 12px 20px;
        flex-direction: column;
        gap: 8px;
    }

    .masspay-item__amount {
        margin-left: 0;
        align-self: flex-end;
    }

    .masspay-totals {
        padding: 16px 20px;
    }

    .payment-method-option {
        padding: 14px;
    }

    .masspay-payment-card .btn {
        width: 100%;
    }
}
