/* ==============================================
   Universal Layout - COMPLETE STYLES (v5.0 CLEAN)
   ============================================== */

/* --- Full Width Layout & Back Button --- */
.woocommerce-account .woocommerce { display: flex; flex-wrap: wrap; }
.woocommerce-account .woocommerce-MyAccount-navigation { display: none !important; }
.woocommerce-account .site,
.woocommerce-account .site-content,
.woocommerce-account .content-area,
.woocommerce-account .site-main,
.woocommerce-account article,
.woocommerce-account .entry-content,
.woocommerce-account .woocommerce,
.woocommerce-account .woocommerce-MyAccount-content {
    max-width: none !important;
}
.woocommerce-account .woocommerce-MyAccount-content {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
body.woocommerce-account.isam-view-order-page .entry-content,
body.woocommerce-account.isam-view-order-page .woocommerce,
body.woocommerce-account.isam-view-order-page .woocommerce-MyAccount-content,
body.woocommerce-account.woocommerce-view-order .entry-content,
body.woocommerce-account.woocommerce-view-order .woocommerce,
body.woocommerce-account.woocommerce-view-order .woocommerce-MyAccount-content {
    width: calc(100vw - 72px) !important;
    max-width: calc(100vw - 72px) !important;
}
body.woocommerce-account.isam-view-order-page .entry-content,
body.woocommerce-account.woocommerce-view-order .entry-content {
    margin-left: calc(50% - 50vw + 36px) !important;
    margin-right: calc(50% - 50vw + 36px) !important;
}
.isam-back-button-wrapper { width: 100%; margin-bottom: 25px; }
.isam-back-button {
    display: inline-block; background-color: #f8f9fa; color: #3c434a;
    border: 1px solid #dee2e6; padding: 10px 20px; border-radius: 6px;
    text-decoration: none; font-weight: 600; transition: all 0.2s ease-in-out;
}
.isam-back-button:hover { background-color: #e9ecef; border-color: #adb5bd; color: #212529; }


/* --- Custom Dashboard --- */
.isam-dashboard-title { text-align: center; font-size: 2.2em; margin-bottom: 40px; }
.isam-dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 25px; }
.isam-dashboard-card {
    background-color: #fff; border: 1px solid #e5e5e5; border-radius: 12px;
    padding: 25px 20px; text-align: center; text-decoration: none; color: #333;
    transition: all 0.3s ease; display: flex; flex-direction: column;
    justify-content: center; align-items: center; min-height: 150px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}
.isam-dashboard-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08); }
.isam-card-icon { font-size: 2.8em; margin-bottom: 15px; }
.isam-card-label { font-size: 1.1em; font-weight: 600; }

/* --- Orders List Page --- */
.isam-order-order-card {
    display: block; text-decoration: none; color: inherit; background: #fff;
    border: 1px solid #e9e9e9; border-radius: 8px; margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.04); transition: all 0.3s ease; padding: 20px;
}
.isam-order-order-card:hover { box-shadow: 0 8px 16px rgba(0,0,0,0.08); transform: translateY(-3px); }
.isam-order-card-body { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.isam-order-product-image img { width: 65px; height: 65px; object-fit: cover; border-radius: 6px; }
.isam-order-product-details { flex-grow: 1; }
.isam-order-product-details .name { font-weight: bold; font-size: 1.1em; margin: 0 0 5px 0; }
.isam-order-product-details .item-count { font-size: 0.9em; color: #777; }
.isam-order-order-amount { font-size: 1.2em; font-weight: bold; color: #333; padding: 0 20px; }
.isam-order-order-meta { text-align: right; min-width: 150px; margin-left: auto; }
.isam-order-order-status {
    padding: 5px 12px; border-radius: 20px; color: #fff; font-weight: bold;
    font-size: 0.8em; text-transform: capitalize; margin-bottom: 5px;
    display: inline-block; background-color: #6c757d; /* --- DEFAULT COLOR --- */
}
.isam-order-order-status.status-completed { background-color: #28a745; }
.isam-order-order-status.status-processing { background-color: #17a2b8; }
.isam-order-order-status.status-on-hold, .isam-order-order-status.status-pending { background-color: #ffc107; color: #333; }
.isam-order-order-status.status-cancelled, .isam-order-order-status.status-failed { background-color: #dc3545; }
.isam-order-order-status.status-refunded { background-color: #6c757d; }
.isam-order-order-meta .date { font-size: 0.9em; color: #777; }
.isam-order-card-footer { padding-top: 15px; margin-top: 15px; border-top: 1px solid #f0f0f0; }
.isam-order-rate-product-link { text-decoration: none; font-weight: bold; color: #007bff; }
.isam-order-card-body-link { color: inherit; text-decoration: none; }

/* --- View Order Page --- */
.universal-layout-wrapper { width: 100%; margin-top: 1em; }
.isam-container { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.9fr); gap: 30px; align-items: start; }
.isam-left-section, .isam-right-section { min-width: 0; }
.isam-card {
    background: #ffffff; border: 1px solid #e9e9e9; border-radius: 8px;
    margin-bottom: 30px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); overflow: hidden;
}
.isam-card-title {
    margin: 0; padding: 20px 25px; font-size: 1.3em;
    border-bottom: 1px solid #eee; background-color: #fcfcfc;
}
.isam-card-subtitle { margin: 0; font-size: 1.1em; margin-bottom: 15px; }
.isam-card-content { padding: 25px; }

/* Product, Address & Totals Tables */
.isam-product-table, .isam-totals-table { width: 100%; border-collapse: collapse; }
.isam-product-item td { padding: 15px 5px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.isam-product-item:last-child td { border-bottom: none; }
.isam-product-thumbnail img { width: 60px; height: 60px; border-radius: 4px; }
.isam-product-name { font-weight: 500; }
.isam-product-name a { text-decoration: none; color: inherit; }
.isam-product-name a:hover { color: #007bff; }
.isam-product-name .product-quantity { display: block; font-size: 0.9em; color: #666; }
.isam-product-total { text-align: right; font-weight: bold; }
.isam-address-section { display: flex; gap: 30px; flex-wrap: wrap; }
.isam-address-box { flex: 1; min-width: 200px; }
.isam-address-box address { font-style: normal; line-height: 1.6; color: #555; margin:0; }
.isam-totals-table th, .isam-totals-table td { padding: 12px 0; border-bottom: 1px solid #f0f0f0; }
.isam-totals-table tr:last-child th, .isam-totals-table tr:last-child td { border-bottom: none; }
.isam-totals-table th { text-align: left; font-weight: normal; color: #555; }
.isam-totals-table td { text-align: right; font-weight: bold; }

/* Order Tracker */
.isam-order-tracker { position: relative; padding-left: 25px; }
.isam-status-list { list-style: none; padding-left: 0; margin-left: 0; }
.isam-status-step { position: relative; padding: 0 0 45px 30px; }
.isam-status-step::before { content: ''; position: absolute; left: 4px; top: 10px; bottom: -5px; width: 2px; background-color: #e0e0e0; z-index: 1; }
.isam-status-step:last-child { padding-bottom: 10px; }
.isam-status-step:last-child::before { display: none; }
.isam-status-dot { position: absolute; left: -2px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background-color: #ccc; border: 3px solid #fff; z-index: 2; transition: background-color 0.3s ease; }
.isam-status-step.completed .isam-status-dot { background-color: #28a745; }
.isam-status-step.completed::before { background-color: #28a745; }
.isam-status-step.current .isam-status-dot { background-color: #007bff; transform: scale(1.2); }
.isam-status-step.current .isam-status-title { font-weight: bold; color: #000; }
.isam-status-info h4, .isam-status-info p { margin: 0; }
.isam-status-title { font-size: 1.1em; color: #888; }
.isam-status-step.completed .isam-status-title { color: #333; }
.isam-status-date { font-size: 0.85em; color: #888; margin-top: 5px; }
.animating-dot { position: absolute; left: -2px; top: 4px; width: 14px; height: 14px; background: #ffc107; border-radius: 50%; z-index: 3; transition: top 1s ease-in-out; }

/* Additional Details Card */
.full-width-card-container { flex-basis: 100%; }
.isam-detail-section { padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px solid #f0f0f0; }
.isam-detail-section:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: none; }
.isam-detail-block { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 1em; }
.isam-detail-block-stacked { align-items: flex-start; gap: 15px; }
.isam-detail-label { color: #555; font-weight: 500; }
.isam-detail-value { color: #000; font-weight: bold; text-align: right; }
.isam-shipment-tracking-info { margin-top: 15px; padding: 15px; background-color: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px; }
.isam-shipment-tracking-info .track-actions a { text-decoration: none; font-weight: bold; }

/* License Keys */
.isam-license-list { display: grid; gap: 14px; }
.isam-license-item {
    border: 1px solid #e8edf2; border-radius: 8px; padding: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.isam-license-product { font-weight: 700; color: #212529; margin-bottom: 4px; }
.isam-license-meta { font-size: 0.85em; color: #6c757d; margin-bottom: 10px; }
.isam-license-key-row {
    display: flex !important; align-items: stretch; gap: 10px; width: 100%;
}
.isam-license-key {
    display: flex; align-items: center; flex: 1 1 auto; min-width: 0; box-sizing: border-box;
    padding: 12px 14px; border-radius: 6px; background: #111827; color: #ffffff;
    font-size: 0.95em; white-space: normal; word-break: break-word; line-height: 1.5;
}
.isam-copy-license-key {
    display: inline-flex !important; align-items: center; justify-content: center;
    width: auto !important; min-width: 82px; min-height: 48px; margin: 0 !important;
    border: 0 !important; border-radius: 6px; background: #007bff; color: #ffffff;
    padding: 0 16px !important; font-weight: 700; line-height: 1 !important; cursor: pointer;
    text-align: center; white-space: nowrap;
}
.isam-copy-license-key:hover { background: #005fcc; }
.isam-copy-license-key.copied { background: #28a745; }
.tm-license-key-line .ul-copy-license-key {
    display: inline-flex !important; align-items: center; justify-content: center;
    width: auto !important; min-width: 82px; min-height: 48px; margin: 0 !important;
    padding: 0 16px !important; border: 0 !important; border-radius: 6px;
    background: #007bff; color: #fff; font-weight: 700; cursor: pointer;
}
.tm-license-key-line .ul-copy-license-key:hover { background: #005fcc; }
.tm-license-key-line .ul-copy-license-key.copied { background: #28a745; }
.isam-renew-license-link {
    display: inline-flex; align-items: center; justify-content: center; margin-top: 12px;
    min-height: 42px; padding: 0 16px; border-radius: 6px; background: #16a34a;
    color: #ffffff !important; font-weight: 700; text-decoration: none !important;
}
.isam-renew-license-link:hover { background: #15803d; }
.isam-download-list { display: grid; gap: 10px; }
.isam-download-link {
    display: block; padding: 12px 14px; border: 1px solid #e8edf2; border-radius: 6px;
    background: #f8fbff; text-decoration: none; font-weight: 700; color: #007bff;
}

/* Dedicated Licenses endpoint */
.tm-account-licenses { padding: 25px; }
.tm-account-licenses > h2 { padding: 0 0 18px !important; background: transparent !important; }
.tm-license-account-card {
    padding: 22px; margin-bottom: 20px; border: 1px solid #e1e7ee;
    border-radius: 8px; background: #fff; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}
.tm-license-account-card h3 { margin: 0 0 18px; font-size: 1.15em; }
.tm-license-facts {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px; margin-bottom: 18px;
}
.tm-license-facts span {
    display: block; min-width: 0; padding: 12px; box-sizing: border-box;
    border: 1px solid #e8edf2; border-radius: 6px; background: #f8fafc;
}
.tm-license-facts small {
    display: block; position: static; margin: 0 0 6px; color: #64748b;
    font-size: 12px; line-height: 1.3; white-space: normal;
}
.tm-license-facts strong {
    display: block; position: static; min-width: 0; margin: 0; overflow-wrap: anywhere;
    font-size: 16px; line-height: 1.35; color: #172033; white-space: normal;
}
.tm-license-facts strong .woocommerce-Price-amount {
    display: inline-flex; align-items: baseline; gap: 2px; float: none;
    margin: 0; white-space: nowrap; font-size: inherit;
}
.tm-license-facts .woocommerce-Price-currencySymbol { display: inline; margin: 0; }
.tm-license-facts strong del { display: none !important; }
.tm-license-facts strong ins { padding: 0; background: transparent; text-decoration: none; }
.tm-license-key-line { display: flex; align-items: stretch; gap: 10px; margin-bottom: 18px; }
.tm-license-key-line code {
    display: flex; align-items: center; flex: 1; min-width: 0; padding: 12px 14px;
    border-radius: 6px; background: #111827; color: #fff; overflow-wrap: anywhere;
}
.tm-license-domains { margin-bottom: 18px; }
.tm-license-domains ul { display: grid; gap: 6px; margin: 8px 0 0; padding-left: 20px; }
.tm-license-downloads { margin: 0 0 18px; }
.tm-license-download-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.tm-license-download {
    display: inline-flex !important; align-items: center; min-height: 42px;
    padding: 0 16px !important; border-radius: 6px !important;
    background: #0f6cbd !important; color: #fff !important;
}
.tm-license-download-notice { margin: 0 0 18px !important; }
.tm-license-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.tm-license-actions .tm-renew-license {
    min-height: 44px; display: inline-flex; align-items: center; padding: 0 18px !important;
    border-radius: 6px !important; background: #16803d !important; color: #fff !important;
    text-decoration: none !important; white-space: nowrap;
}
.tm-add-domain-form { flex: 1 1 420px; display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 8px; padding: 0 !important; }
.tm-add-domain-form input[type="text"] { min-height: 44px; margin: 0; }
.tm-add-domain-form button { min-height: 44px; margin: 0 !important; }
.tm-add-domain-form small { grid-column: 1 / -1; color: #64748b; }

/* New My Licenses flow */
.isam-license-screen { padding: 25px; }
.isam-license-screen > h2 { margin: 0 0 18px; padding: 0 !important; background: transparent !important; }
.isam-license-product-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.isam-license-product-card {
    display: grid; gap: 8px; padding: 16px; border: 1px solid #e1e7ee; border-radius: 8px;
    background: #fff; color: #172033; text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .05);
}
.isam-license-product-card:hover { border-color: #0f6cbd; box-shadow: 0 8px 18px rgba(15, 23, 42, .08); }
.isam-license-product-card strong { font-size: 1rem; line-height: 1.35; }
.isam-license-product-card span { color: #0f6cbd; font-weight: 700; }
.isam-license-product-card small { color: #64748b; }
.isam-license-detail { padding: 25px; }
.isam-license-detail-card { margin-top: 18px; }
.isam-license-detail-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px; margin-bottom: 18px;
}
.isam-license-detail-grid span {
    display: block; min-width: 0; padding: 12px; border: 1px solid #e8edf2;
    border-radius: 6px; background: #f8fafc;
}
.isam-license-detail-grid small { display: block; margin-bottom: 6px; color: #64748b; font-size: 12px; }
.isam-license-detail-grid strong { display: block; color: #172033; overflow-wrap: anywhere; }
.isam-license-key-label { display: block; margin: 0 0 8px; font-weight: 700; }
.isam-license-key-row { display: flex; align-items: stretch; gap: 10px; margin-bottom: 18px; }
.isam-license-key-row code {
    display: flex; align-items: center; flex: 1; min-width: 0; padding: 12px 14px;
    border-radius: 6px; background: #111827; color: #fff; overflow-wrap: anywhere;
}
.isam-license-domains { margin-bottom: 18px; }
.isam-license-domains ul { display: grid; gap: 6px; margin: 8px 0 0; padding-left: 20px; }
.isam-license-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.isam-renew-license {
    display: inline-flex !important; align-items: center; min-height: 44px; padding: 0 18px !important;
    border-radius: 6px !important; background: #16803d !important; color: #fff !important;
    text-decoration: none !important; white-space: nowrap;
}
.isam-add-domain-form { flex: 1 1 420px; display: grid; grid-template-columns: minmax(200px, 1fr) auto; gap: 8px; padding: 0 !important; }
.isam-add-domain-form input[type="url"] { min-height: 44px; margin: 0; }
.isam-add-domain-form button { min-height: 44px; margin: 0 !important; }
.isam-add-domain-form small { grid-column: 1 / -1; color: #64748b; }

/* == GENERIC CONTENT CARD STYLING (v4) ======== */
.isam-generic-card { padding: 0 !important; }
.isam-generic-card > *:first-child { margin-top: 0; }
.isam-generic-card h2, .isam-generic-card legend { font-size: 1.5em; margin: 0; padding: 20px 25px; border-bottom: 1px solid #eee; background-color: #fcfcfc; }
.isam-generic-card form, .isam-generic-card table, .isam-generic-card .woocommerce-Addresses { padding: 25px; }
.isam-generic-card form .form-row { padding: 10px 0; }
.isam-generic-card form label { font-weight: 600; }
.isam-generic-card input[type="text"], .isam-generic-card input[type="email"], .isam-generic-card input[type="tel"], .isam-generic-card input[type="password"], .isam-generic-card select, .isam-generic-card textarea {
    width: 100%; padding: 12px 15px !important; border-radius: 6px !important; border: 1px solid #ccc !important;
}
.isam-generic-card .woocommerce-Button, .isam-generic-card button[type="submit"] {
    background-color: #212529 !important; color: #fff !important; padding: 12px 25px !important;
    border-radius: 6px !important; font-weight: bold !important; border: none !important;
    margin-top: 15px; cursor: pointer; transition: background-color 0.2s ease;
}
.isam-generic-card .woocommerce-Button:hover, .isam-generic-card button[type="submit"]:hover { background-color: #007bff !important; }
.isam-generic-card .woocommerce-Addresses.col2-set { display: grid; grid-template-columns: 1fr; gap: 30px; padding: 25px; }
.isam-generic-card .woocommerce-Address-title h3 { font-size: 1.2em; margin-top: 0; }
.isam-generic-card table.shop_table { border-radius: 0; box-shadow: none; }
.isam-generic-card .woocommerce-downloads-table a.woocommerce-MyAccount-downloads-file { font-weight: bold; color: #007bff; }

/* =============================================
/* == MOBILE RESPONSIVE FIXES (v4) =============
/* ============================================= */
@media (max-width: 768px) {
    body.woocommerce-account.isam-view-order-page .entry-content,
    body.woocommerce-account.isam-view-order-page .woocommerce,
    body.woocommerce-account.isam-view-order-page .woocommerce-MyAccount-content,
    body.woocommerce-account.woocommerce-view-order .entry-content,
    body.woocommerce-account.woocommerce-view-order .woocommerce,
    body.woocommerce-account.woocommerce-view-order .woocommerce-MyAccount-content {
        width: 100% !important;
        max-width: 100% !important;
    }
    body.woocommerce-account.isam-view-order-page .entry-content,
    body.woocommerce-account.woocommerce-view-order .entry-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* View Order Page: Stack columns */
    .isam-container { display: flex; flex-direction: column; gap: 0; }
    .isam-card { margin-bottom: 25px; }
    .isam-license-key-row { flex-direction: column; }
    .isam-copy-license-key { min-height: 42px; }
    .tm-account-licenses { padding: 18px; }
    .tm-license-account-card { padding: 16px; }
    .tm-license-facts { grid-template-columns: 1fr; }
    .tm-license-key-line { flex-direction: column; }
    .tm-add-domain-form { grid-template-columns: 1fr; }
    .tm-add-domain-form small { grid-column: auto; }
    .isam-license-screen, .isam-license-detail { padding: 18px; }
    .isam-license-key-row { flex-direction: column; }
    .isam-add-domain-form { grid-template-columns: 1fr; }
    .isam-add-domain-form small { grid-column: auto; }

    /* Orders List Page: Better wrapping */
    .isam-order-card-body { flex-direction: column; align-items: flex-start; }
    .isam-order-order-meta { margin-left: 0; text-align: left; margin-top: 15px; }
    .isam-order-order-amount { padding: 15px 0 0 0; }

    /* Generic Address card */
    .isam-generic-card .woocommerce-Addresses.col2-set { grid-template-columns: 1fr; }
}

/* =======================================================
/* == UNIVERSAL LAYOUT - FINAL THEME OVERRIDE (v5.0) ==
/* ======================================================= */

/* KADAM 1: THEME KE MAIN CONTAINER KO FULL-WIDTH BANANA */
/* Yeh sirf "My Account" page par hi kaam karega */
body.woocommerce-account .entry-content {
    max-width: none !important; /* Theme ki max-width ko hatata hai */
    padding: 0 !important;      /* Theme ki extra padding ko hatata hai */
}

/* KADAM 2: ADDRESS PAGE KE DESIGN KO THEEK KARNA */

/* Upar wale default notice ko hatana */
.woocommerce-account .woocommerce-MyAccount-content > p:first-child {
    display: none !important;
}

/* Address card ke andar default box-style ko hatana */
.isam-generic-card .woocommerce-Addresses .woocommerce-Address {
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* "Billing address" aur "Shipping address" heading ko theek karna */
.isam-generic-card .woocommerce-Address-title {
    border-bottom: 1px solid #eee !important;
    padding-bottom: 15px !important;
    margin-bottom: 20px !important;
    display: flex !important;
    justify-content: space-between !importanT;
    align-items: center !important;
}

.isam-generic-card .woocommerce-Address-title h3 {
    font-size: 1.3em !important;
    margin: 0 !important;
}

/* Edit link ko button jaisa banana */
.isam-generic-card .woocommerce-Address-title .edit {
    font-size: 0.9em !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    background-color: #f0f0f0 !important;
    padding: 6px 12px !important;
    border-radius: 5px !important;
    color: #333 !important;
    border: 1px solid #ddd !important;
    transition: all 0.2s ease;
}

.isam-generic-card .woocommerce-Address-title .edit:hover {
    background-color: #e0e0e0 !important;
    border-color: #ccc !important;
}

/* Address ke text ko theek karna */
.isam-generic-card .woocommerce-Address address {
    font-style: normal !important;
    line-height: 1.7 !important;
    color: #555 !important;
    padding: 0 !important;
    border: none !important;
    margin: 0 !important;
}
