/**
 * BHD Woo Licenses Manager - Frontend Styles
 * Modern, Dashboard-aligned design matching standard theme elements
 */

:root {
    --bhd-front-primary: #0f172a;
    --bhd-front-secondary: #64748b;
    --bhd-front-bg: #f8fafc;
    --bhd-front-border: #e2e8f0;
    --bhd-front-blue: #3b82f6;
    --bhd-front-dark-blue: #4f46e5;
    --bhd-front-danger: #ef4444;
    --bhd-front-success: #22c55e;
    --bhd-front-radius: 12px;
    --bhd-front-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

.bhd-wlm-order-licenses {
    margin: 32px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 1000px;
    width: 100%;
}

/* Header block style */
.bhd-wlm-header-block {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.bhd-wlm-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background-color: #eff6ff;
    color: #2563eb;
    flex-shrink: 0;
}

.bhd-wlm-header-content h2 {
    font-size: 20px;
    font-weight: 700;
    color: inherit;
    margin: 0 0 4px 0;
    border: none;
    padding: 0;
    line-height: 1.3;
}

.bhd-wlm-subtitle {
    font-size: 14px;
    color: inherit;
    opacity: 0.8;
    margin: 0;
}

/* Card layout */
.bhd-wlm-card {
    background: #ffffff !important;
    color: #334155 !important;
    border: 1px solid var(--bhd-front-border);
    border-radius: var(--bhd-front-radius);
    box-shadow: var(--bhd-front-shadow);
    overflow: hidden;
}

.bhd-wlm-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px; /* Generous side padding matching table */
    border-bottom: 1px solid var(--bhd-front-border);
    flex-wrap: wrap;
    gap: 16px;
    background: #ffffff !important;
}

.bhd-wlm-card-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bhd-wlm-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bhd-wlm-card-title-row h3 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a !important;
    margin: 0 !important;
    width: auto !important;
    flex-grow: 0 !important;
    display: inline-block !important;
    line-height: 1.2;
}

.bhd-wlm-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #eff6ff !important;
    color: #2563eb !important;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 9999px;
    line-height: 1;
    margin-left: 8px !important;
}

.bhd-wlm-card-subtitle {
    font-size: 13px;
    color: #64748b !important;
    margin: 0;
    line-height: 1.4;
}

.bhd-wlm-card-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Button styles */
.bhd-wlm-card-actions .button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    line-height: 1.2 !important;
    border-radius: 6px !important;
    padding: 10px 18px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.2s ease !important;
}

/* "Sao chép tất cả" button gets light scheme styling */
.bhd-wlm-card-actions .button.bhd-wlm-copy-all-btn {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}

.bhd-wlm-card-actions .button.bhd-wlm-copy-all-btn:hover {
    background-color: #f8fafc !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

/* "Tải tất cả" button retains theme primary but gets standard borders */
.bhd-wlm-card-actions .button.bhd-wlm-download-btn {
    border: 1px solid transparent !important;
}

/* Table Wrapper for responsiveness */
.bhd-wlm-table-wrapper {
    width: 100%;
    overflow-x: hidden;
}

/* Table styling */
.bhd-wlm-licenses-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    border: none;
    table-layout: fixed;
}

.bhd-wlm-licenses-table th,
.bhd-wlm-licenses-table td {
    padding: 16px 24px !important;
    text-align: left;
    vertical-align: middle !important;
}

/* Side padding fixes for alignment */
.bhd-wlm-licenses-table td:first-child,
.bhd-wlm-licenses-table th:first-child {
    padding-left: 32px !important;
}

.bhd-wlm-licenses-table td:last-child,
.bhd-wlm-licenses-table th:last-child {
    padding-right: 32px !important;
}

.bhd-wlm-licenses-table th {
    background-color: #f8fafc !important;
    font-size: 12px;
    font-weight: 600;
    color: #475569 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--bhd-front-border);
    white-space: nowrap !important; /* Prevent text wrapping */
}

.bhd-wlm-licenses-table td {
    border-bottom: 1px solid var(--bhd-front-border);
    background-color: #ffffff !important;
}

.bhd-wlm-licenses-table tbody tr:last-child td {
    border-bottom: none;
}

/* Product Header Row */
.bhd-wlm-product-header-row td {
    background-color: #f8fafc !important;
    padding: 12px 32px !important;
    border-bottom: 1px solid var(--bhd-front-border) !important;
    border-top: 1px solid var(--bhd-front-border) !important;
}

.bhd-wlm-licenses-table tbody tr:first-child.bhd-wlm-product-header-row td {
    border-top: none !important;
}

.bhd-wlm-table-product-title {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #475569 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    margin: 0 !important;
    line-height: 1.5 !important;
}

.col-index {
    width: 50px !important;
    font-size: 14px;
    font-weight: 500;
    color: #64748b !important;
    text-align: center !important;
}

.col-action {
    width: 140px !important;
    text-align: center !important;
}

/* License Info Styles */
.bhd-wlm-license-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 100%;
    overflow: hidden;
    justify-content: center;
}

.bhd-wlm-key-container {
    display: flex;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.bhd-wlm-key-code {
    display: block;
    width: 100%;
    max-width: 100%;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    color: #334155 !important;
    background-color: #f8fafc !important;
    border: 1px solid var(--bhd-front-border) !important;
    border-radius: 6px;
    padding: 8px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.bhd-wlm-expires-tag {
    font-size: 12px;
    color: #ef4444 !important;
    font-weight: 500;
}

/* Row Actions */
.bhd-wlm-row-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.bhd-wlm-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #cbd5e1 !important;
    background-color: #ffffff !important;
    color: var(--bhd-front-secondary) !important;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.bhd-wlm-action-btn:hover {
    background-color: var(--bhd-front-bg) !important;
    color: var(--bhd-front-primary) !important;
    border-color: #94a3b8 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

/* Footer layout */
.bhd-wlm-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px; /* Side padding matching table */
    background-color: #ffffff !important;
    border-top: 1px solid var(--bhd-front-border);
    flex-wrap: wrap;
    gap: 16px;
}

.bhd-wlm-footer-info {
    font-size: 13px;
    color: #64748b !important;
    font-weight: 500;
}

.bhd-wlm-footer-controls {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.bhd-wlm-per-page-select-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #64748b !important;
}

.bhd-wlm-per-page-select-wrapper label {
    white-space: nowrap !important;
    display: inline-block !important;
}

.bhd-wlm-per-page-select {
    padding: 4px 28px 4px 8px;
    font-size: 13px;
    border: 1px solid var(--bhd-front-border) !important;
    border-radius: 6px;
    background-color: #ffffff !important;
    color: #334155 !important;
    cursor: pointer;
    outline: none;
    height: auto;
    line-height: 1.5;
}

.bhd-wlm-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bhd-wlm-page-numbers-container {
    display: flex;
    gap: 4px;
}

.bhd-wlm-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: #ffffff !important;
    color: var(--bhd-front-secondary) !important;
    border: 1px solid var(--bhd-front-border) !important;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.bhd-wlm-page-btn:hover:not(:disabled) {
    background-color: #eff6ff !important;
    color: #2563eb !important;
    border-color: #bfdbfe !important;
}

.bhd-wlm-page-btn.active {
    background-color: #eff6ff !important;
    color: #2563eb !important;
    border-color: #bfdbfe !important;
}

.bhd-wlm-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Loading Placeholder & Spinner Styles */
.bhd-wlm-loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    background: #ffffff !important;
    border: 1px solid var(--bhd-front-border);
    border-radius: var(--bhd-front-radius);
    box-shadow: var(--bhd-front-shadow);
    text-align: center;
}

.bhd-wlm-spinner {
    width: 40px;
    height: 40px;
    border: 3.5px solid #f1f5f9;
    border-top: 3.5px solid #4f46e5;
    border-radius: 50%;
    animation: bhd-wlm-spin 0.8s linear infinite;
    margin-bottom: 20px;
}

.bhd-wlm-loading-text {
    font-size: 15px;
    color: #475569 !important;
    font-weight: 500;
    margin: 0;
}

@keyframes bhd-wlm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .bhd-wlm-card-header {
        padding: 20px 24px;
        flex-direction: column;
        align-items: stretch;
    }
    .bhd-wlm-card-actions {
        width: 100%;
        justify-content: space-between;
        gap: 8px !important;
    }
    .bhd-wlm-card-actions .button {
        flex-grow: 1;
        margin: 0 !important;
    }
    .bhd-wlm-card-footer {
        padding: 20px 24px;
        flex-direction: column;
        align-items: stretch;
    }
    .bhd-wlm-footer-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    .bhd-wlm-per-page-select-wrapper {
        justify-content: space-between;
    }
    .bhd-wlm-pagination {
        justify-content: space-between;
    }
    .bhd-wlm-licenses-table td:first-child,
    .bhd-wlm-licenses-table th:first-child {
        padding-left: 20px !important;
    }
    .bhd-wlm-licenses-table td:last-child,
    .bhd-wlm-licenses-table th:last-child {
        padding-right: 20px !important;
    }
    .bhd-wlm-product-header-row td {
        padding: 12px 20px !important;
    }
}

@media (max-width: 600px) {
    .bhd-wlm-licenses-table th,
    .bhd-wlm-licenses-table td {
        padding: 12px 10px !important;
    }
    .bhd-wlm-licenses-table th {
        font-size: 10px !important;
        letter-spacing: 0px !important;
    }
    .col-index {
        width: 35px !important;
    }
    .col-action {
        width: 96px !important;
    }
    .bhd-wlm-action-btn {
        width: 28px;
        height: 28px;
    }
    .bhd-wlm-per-page-select-wrapper select {
        padding: 4px 20px 4px 6px;
    }
}

/* =========================================
   LOOP STOCK BADGE STYLES 
   ========================================= */

.bhd-wlm-stock-badge {
    margin-top: 8px;
    margin-bottom: 8px;
    display: inline-block !important;
    /* Force display */
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    z-index: 10;
    position: relative;
    width: auto;
    max-width: 100%;
}

/* Template: Simple (Text Only) */
.bhd-wlm-stock-badge.is-simple {
    color: var(--bhd-front-success);
    font-weight: 600;
}

/* Template: Modern (Faint Background Badge) */
.bhd-wlm-stock-badge.is-modern {
    background-color: #dcfce7;
    color: #166534;
    padding: 4px 12px;
    border-radius: 9999px;
    /* Pill shape */
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Template: Neon (Black BG + Green Glow) */
.bhd-wlm-stock-badge.is-neon {
    color: #4ade80;
    background-color: #000;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #22c55e;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
    font-family: monospace;
    letter-spacing: 0.5px;
}

/* Template: Outline (Border Only) */
.bhd-wlm-stock-badge.is-outline {
    background-color: transparent;
    border: 1px solid var(--bhd-front-success);
    color: var(--bhd-front-success);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}