/**
 * IMPROVR Public Styles
 * Frontend CSS für das IMPROVR Subscription System
 */

/* Dashboard Section */
.improvr-dashboard-section {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
}

.improvr-dashboard-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #333;
}

/* Status Grid */
.improvr-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
}

.status-item .label {
    font-weight: 600;
    color: #666;
}

.status-item .value {
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Code Display */
.improvr-code,
code.improvr-code {
    font-family: monospace;
    font-size: 16px;
    padding: 5px 10px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 3px;
    user-select: all;
}

.improvr-copy-code,
.copy-code-btn {
    padding: 5px 10px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s ease;
}

.improvr-copy-code:hover,
.copy-code-btn:hover {
    background: #005a87;
}

/* User Code Widget */
.improvr-user-code-widget {
    margin: 20px 0;
}

.improvr-user-code-widget label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

.code-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.code-box {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.code-box code {
    font-size: 18px;
    padding: 10px 20px;
    background: #fff;
    border: 2px solid #0073aa;
    border-radius: 5px;
}

/* Registration Form */
.improvr-registration-info {
    background: #f0f8ff;
    padding: 15px;
    border-radius: 3px;
    margin-bottom: 20px;
}

.improvr-info {
    display: block;
    color: #333;
    font-size: 14px;
}

/* Code Validation */
.code-validation-message {
    display: block;
    margin-top: 5px;
    font-size: 13px;
}

.code-validation-message .validating {
    color: #999;
}

.code-validation-message .valid {
    color: #46b450;
}

.code-validation-message .invalid {
    color: #dc3232;
}

input.valid {
    border-color: #46b450 !important;
}

input.invalid {
    border-color: #dc3232 !important;
}

/* Username Validation */
.username-validation-message {
    display: block;
    margin-top: 5px;
    font-size: 13px;
}

.username-validation-message .validating {
    color: #999;
}

.username-validation-message .valid {
    color: #46b450;
}

.username-validation-message .invalid {
    color: #dc3232;
}

.username-validation-message .error {
    color: #dc3232;
}

/* Username Field Styling */
#b2bking_field_163 {
    font-family: monospace;
    text-transform: lowercase;
}

#b2bking_field_163.valid {
    border-color: #46b450 !important;
    background-color: #f0f8f0 !important;
}

#b2bking_field_163.invalid {
    border-color: #dc3232 !important;
    background-color: #fff5f5 !important;
}

/* SubAccount Management */
.improvr-subaccount-management {
    margin: 20px 0;
}

.improvr-subaccount-stats {
    margin-bottom: 20px;
}

.improvr-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-box {
    background: #f0f0f1;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
}

.stat-box h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #666;
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

/* SubAccounts Table */
.improvr-subaccounts-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.improvr-subaccounts-table th,
.improvr-subaccounts-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.improvr-subaccounts-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.improvr-subaccounts-table tr:hover {
    background: #f9f9f9;
}

/* Assignment Form */
.improvr-subaccount-assignment-form {
    margin-top: 20px;
}

.improvr-assignment-checkbox {
    cursor: pointer;
}

.improvr-save-assignments {
    padding: 5px 15px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.improvr-save-assignments:hover {
    background: #005a87;
}

.improvr-save-assignments.has-changes {
    background: #f0ad4e;
}

.improvr-save-assignments:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Affiliate Stats */
.improvr-affiliate-stats {
    margin: 20px 0;
}

.stat-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
}

.stat-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.affiliate-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-box {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 5px;
}

.stat-label {
    display: block;
    font-size: 13px;
    color: #666;
}

/* Provisions Stats */
.provision-stats-summary {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 3px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e5e5e5;
}

.stat-row:last-child {
    border-bottom: none;
}

/* Links */
.improvr-link {
    color: #0073aa;
    text-decoration: none;
    font-size: 13px;
}

.improvr-link:hover {
    text-decoration: underline;
}

/* Notices */
.improvr-notice {
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 3px;
    background: #fff;
    border-left: 4px solid #0073aa;
}

.improvr-notice.error {
    border-left-color: #dc3232;
    background: #fef1f1;
}

.improvr-notice.warning {
    border-left-color: #ffb900;
    background: #fff8e5;
}

.improvr-notice.success {
    border-left-color: #46b450;
    background: #eff9ef;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-radius: 50%;
    border-top-color: #0073aa;
    animation: improvr-spin 1s linear infinite;
}

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

/* Tooltips */
.improvr-tooltip {
    position: relative;
    cursor: help;
    display: inline-block;
}

.improvr-tooltip:after {
    content: '?';
    display: inline-block;
    width: 16px;
    height: 16px;
    background: #666;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    margin-left: 5px;
}

.improvr-tooltip-content {
    position: absolute;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.improvr-tooltip-content::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    margin-left: -5px;
    border-width: 5px 5px 0;
    border-style: solid;
    border-color: #333 transparent transparent;
}

/* Group License Info */
.improvr-group-license-info {
    background: #e8f5e9;
    padding: 15px;
    border-radius: 3px;
    margin: 10px 0;
    border: 1px solid #4caf50;
}

.improvr-group-license-info p {
    margin: 5px 0;
}

/* Expandable Sections */
.improvr-expandable-header {
    cursor: pointer;
    padding: 10px 15px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin-bottom: 0;
    position: relative;
}

.improvr-expandable-header:after {
    content: '▼';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s;
}

.improvr-expandable-header.expanded:after {
    transform: translateY(-50%) rotate(180deg);
}

.improvr-expandable-content {
    display: none;
    padding: 15px;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 3px 3px;
    background: #fafafa;
}

/* Responsive Tables */
@media (max-width: 768px) {
    .improvr-subaccounts-table.stacked,
    .improvr-affiliations-table.stacked {
        border: 0;
    }
    
    .improvr-subaccounts-table.stacked thead {
        display: none;
    }
    
    .improvr-subaccounts-table.stacked tr {
        display: block;
        margin-bottom: 10px;
        border: 1px solid #ddd;
        border-radius: 3px;
    }
    
    .improvr-subaccounts-table.stacked td {
        display: block;
        text-align: right;
        padding-left: 50%;
        position: relative;
        border: none;
    }
    
    .improvr-subaccounts-table.stacked td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        text-align: left;
        font-weight: 600;
    }
}

/* Mobile Optimizations */
@media (max-width: 600px) {
    .improvr-status-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-section {
        padding: 15px;
    }
    
    .code-display {
        flex-direction: column;
        align-items: stretch;
    }
    
    .improvr-copy-code,
    .copy-code-btn {
        width: 100%;
        margin-top: 10px;
    }
    
    .improvr-dashboard-section {
        padding: 15px;
    }
}

/* WooCommerce Account Integration */
.woocommerce-MyAccount-navigation-link--provisions a:before {
    content: '€';
    margin-right: 8px;
    font-weight: bold;
    font-size: 16px;
}

.woocommerce-MyAccount-navigation-link--subaccounts a:before {
    content: '⚑';
    margin-right: 8px;
    font-size: 16px;
}

.woocommerce-MyAccount-navigation-link--affiliate-stats a:before {
    content: '▣';
    margin-right: 8px;
    font-size: 16px;
}

.woocommerce-MyAccount-navigation-link--subscriptions a:before {
    content: '◔';
    margin-right: 8px;
    font-size: 16px;
}

/* Print Styles */
@media print {
    .improvr-copy-code,
    .copy-code-btn,
    .improvr-save-assignments {
        display: none;
    }
    
    .improvr-code {
        border: 1px solid #000;
        padding: 5px;
    }
}




















/* Grundästhetik */
.woocommerce-account .woocommerce table.shop_table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,.06);
}
.woocommerce-account .woocommerce table.shop_table th,
.woocommerce-account .woocommerce table.shop_table td {
  padding: 14px 16px;
  vertical-align: middle;
}
.woocommerce-account .woocommerce table.shop_table thead {
  background: #f9fafb;
  color: #111827;
  font-weight: 600;
}
.woocommerce-account .woocommerce table.shop_table tbody tr + tr td {
  border-top: 1px solid #f1f5f9;
}

/* Buttons (Aktionen) */
.woocommerce-account .woocommerce a.button,
.woocommerce-account .woocommerce .button {
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  background: #111827;
  color: #fff;
  transition: transform .05s ease, box-shadow .2s ease, background .2s ease;
}
.woocommerce-account .woocommerce a.button:hover,
.woocommerce-account .woocommerce .button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
  background: #0b0f1a;
}

/* Mobile: Tabelle -> Karten */
@media (max-width: 760px) {
  .woocommerce-account .woocommerce table.shop_table thead {
    display: none;
  }
  .woocommerce-account .woocommerce table.shop_table,
  .woocommerce-account .woocommerce table.shop_table tbody,
  .woocommerce-account .woocommerce table.shop_table tr,
  .woocommerce-account .woocommerce table.shop_table td {
    display: block;
    width: 100%;
  }
  .woocommerce-account .woocommerce table.shop_table tr {
    background: #fff;
    margin: 0 0 14px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0,0,0,.06);
    overflow: hidden;
  }
  .woocommerce-account .woocommerce table.shop_table td {
    border: 0;
    border-top: 1px solid #f3f4f6;
    position: relative;
    padding-left: 46px;
  }
  .woocommerce-account .woocommerce table.shop_table td:first-child {
    border-top: 0;
  }
  .woocommerce-account .woocommerce table.shop_table td::before {
    content: attr(data-title);
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    font-size: 12px;
    color: #6b7280;
  }
}

/* Spezifische Spalten dezent formatieren */
.woocommerce-account .woocommerce table.shop_table td.order-number a,
.woocommerce-account .woocommerce table.shop_table td.subscription-number a {
  font-weight: 700;
  text-decoration: none;
}
.woocommerce-account .woocommerce table.shop_table td.order-status,
.woocommerce-account .woocommerce table.shop_table td.subscription-status {
  text-transform: capitalize;
  font-weight: 600;
}
.woocommerce-account .woocommerce table.shop_table td.order-total small {
  display: block;
  color: #6b7280;
  margin-top: 2px;
  font-size: 12px;
}
/* ===== Kantenkleber-Fix für Product/Total/Actions ===== */
:root {
  --acc-pad-y: 14px;
  --acc-pad-x: 16px;
  --acc-label-w: 132px;
  --acc-border: #e5e7eb;
}

/* 1) Product/Total immer mit sauberem Innenabstand (Desktop) */
.woocommerce-account .woocommerce table.shop_table td.woocommerce-table__product-name,
.woocommerce-account .woocommerce table.shop_table td.product-name,
.woocommerce-account .woocommerce table.shop_table td.subscription-product,
.woocommerce-account .woocommerce table.shop_table td.woocommerce-table__product-total,
.woocommerce-account .woocommerce table.shop_table td.product-total {
  padding-left: var(--acc-pad-x) !important;
  padding-right: var(--acc-pad-x) !important;
}

/* 2) Actions-Zelle: immer Innenabstand + Buttons mit Luft */
.woocommerce-account .woocommerce table.shop_table td.order-actions,
.woocommerce-account .woocommerce table.shop_table td.subscription-actions {
  padding: var(--acc-pad-y) var(--acc-pad-x) !important;
  white-space: normal;
}
.woocommerce-account .woocommerce table.shop_table td.order-actions .button,
.woocommerce-account .woocommerce table.shop_table td.subscription-actions .button,
.woocommerce-account .woocommerce a.wcs-switch-link,               /* Subscriptions "Upgrade or Downgrade" */
.woocommerce-account .woocommerce .button.switch {                 /* manche Themes benennen den Switch so */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 6px 8px 0 0; /* Abstand zwischen mehreren Buttons */
  padding: 10px 14px;
  border: 1px solid var(--acc-border);
  border-radius: 10px;
  text-decoration: none;
}

/* 3) Produkt-Meta (z.B. Amount of players / Subscription period) hübsch einrücken */
.woocommerce-account .woocommerce table.shop_table td .wc-item-meta {
  margin-top: 6px;
}
.woocommerce-account .woocommerce table.shop_table td .wc-item-meta li {
  display: flex;
  gap: 6px;
  line-height: 1.3;
}
.woocommerce-account .woocommerce table.shop_table td .wc-item-meta li p {
  margin: 0;
}

/* 4) Mobile: respektiert dein Label-Fenster – nichts klebt am Rand */
@media (max-width: 760px) {
  /* Product/Total auf Kartenlayout: linker Einzug = Label-Fenster + Padding */
  .woocommerce-account .woocommerce table.shop_table td.woocommerce-table__product-name[data-title],
  .woocommerce-account .woocommerce table.shop_table td.product-name[data-title],
  .woocommerce-account .woocommerce table.shop_table td.subscription-product[data-title],
  .woocommerce-account .woocommerce table.shop_table td.woocommerce-table__product-total[data-title],
  .woocommerce-account .woocommerce table.shop_table td.product-total[data-title] {
    padding-left: calc(var(--acc-label-w) + var(--acc-pad-x)) !important;
    padding-right: var(--acc-pad-x) !important;
  }

  /* Actions stapeln mit Abstand und gleichem Innenabstand */
  .woocommerce-account .woocommerce table.shop_table td.order-actions[data-title],
  .woocommerce-account .woocommerce table.shop_table td.subscription-actions[data-title] {
    padding-left: calc(var(--acc-label-w) + var(--acc-pad-x)) !important;
  }
  .woocommerce-account .woocommerce table.shop_table td.order-actions,
  .woocommerce-account .woocommerce table.shop_table td.subscription-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Sicherheitsnetz: jede Card hat rechts/links Luft */
  .woocommerce-account .woocommerce table.shop_table tr > :first-child,
  .woocommerce-account .woocommerce table.shop_table tr > :last-child {
    padding-left: calc(var(--acc-label-w) + var(--acc-pad-x)) !important;
    padding-right: var(--acc-pad-x) !important;
  }
}

/* 5) (Optional) Langläufer schön umbrechen – keine Berührung mit dem Rand */
.woocommerce-account .woocommerce table.shop_table td,
.woocommerce-account .woocommerce table.shop_table th {
  word-wrap: break-word;
  overflow-wrap: anywhere;
}