/**
 * WHMCS Product Manager - Public Styles
 * 
 * Frontend styles for pricing tables and domain tables
 */

/* ==========================================================================
   Base Variables (can be overridden by table styles)
   ========================================================================== */
:root {
    --wpm-table-primary: #2563eb;
    --wpm-table-primary-hover: #1d4ed8;
    --wpm-table-text: #374151;
    --wpm-table-text-light: #6b7280;
    --wpm-table-border: #e5e7eb;
    --wpm-table-radius: 12px;
    --wpm-table-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Table Container
   ========================================================================== */
.wpm-table-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.wpm-table-container *,
.wpm-table-container *::before,
.wpm-table-container *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Product Tables - Vertical Layout
   ========================================================================== */
.wpm-product-table {
    display: grid;
    gap: 24px;
}

.wpm-product-table.wpm-columns-1 { grid-template-columns: 1fr; }
.wpm-product-table.wpm-columns-2 { grid-template-columns: repeat(2, 1fr); }
.wpm-product-table.wpm-columns-3 { grid-template-columns: repeat(3, 1fr); }
.wpm-product-table.wpm-columns-4 { grid-template-columns: repeat(4, 1fr); }
.wpm-product-table.wpm-columns-5 { grid-template-columns: repeat(5, 1fr); }
.wpm-product-table.wpm-columns-6 { grid-template-columns: repeat(6, 1fr); }
.wpm-product-table.wpm-columns-7 { grid-template-columns: repeat(7, 1fr); }
.wpm-product-table.wpm-columns-8 { grid-template-columns: repeat(8, 1fr); }

/* Responsive */
@media (max-width: 1200px) {
    .wpm-product-table.wpm-columns-5,
    .wpm-product-table.wpm-columns-6,
    .wpm-product-table.wpm-columns-7,
    .wpm-product-table.wpm-columns-8 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .wpm-product-table {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .wpm-product-table {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .wpm-product-table {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   Product Card
   ========================================================================== */
.wpm-product-card {
    position: relative;
    background: #ffffff;
    border-radius: var(--wpm-table-radius);
    border: 1px solid var(--wpm-table-border);
    box-shadow: var(--wpm-table-shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wpm-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

.wpm-product-card.wpm-highlighted {
    border-color: var(--wpm-table-primary);
    border-width: 2px;
    transform: scale(1.02);
}

.wpm-product-card.wpm-highlighted:hover {
    transform: scale(1.02) translateY(-4px);
}

/* Highlight Badge */
.wpm-highlight-badge {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 20px;
    background: var(--wpm-table-primary);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 0 0 8px 8px;
}

/* Card Content */
.wpm-product-content {
    padding: 32px 24px 24px;
}

.wpm-highlighted .wpm-product-content {
    padding-top: 40px;
}

/* Product Title */
.wpm-product-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    text-align: center;
    margin: 0 0 16px;
    line-height: 1.3;
}

/* Product Price */
.wpm-product-price {
    text-align: center;
    margin-bottom: 24px;
}

.wpm-price-amount {
    font-size: 36px;
    font-weight: 700;
    color: var(--wpm-table-primary);
    line-height: 1;
}

.wpm-price-currency {
    font-size: 20px;
    vertical-align: super;
}

.wpm-price-period {
    display: block;
    font-size: 14px;
    color: var(--wpm-table-text-light);
    margin-top: 4px;
}

/* Product Features */
.wpm-product-features {
    list-style: none;
    padding: 20px 0;
    margin: 0;
    border-top: 1px solid var(--wpm-table-border);
}

.wpm-product-features li {
    display: flex;
    align-items: center;
    padding: 10px 0;
    font-size: 14px;
    color: var(--wpm-table-text);
    line-height: 1.5;
}

.wpm-product-features li::before {
    content: "";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin-right: 12px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 50%;
}

.wpm-product-features li::after {
    content: "✓";
    position: absolute;
    margin-left: 6px;
    color: #10b981;
    font-size: 12px;
    font-weight: bold;
}

.wpm-product-features li {
    position: relative;
}

.wpm-product-features li::after {
    position: static;
    margin-left: -26px;
    margin-right: 18px;
}

/* Feature Icons */
.wpm-feature-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    color: var(--wpm-table-primary);
}

/* Product Button */
.wpm-product-button {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background: var(--wpm-table-primary);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.wpm-product-button:hover {
    background: var(--wpm-table-primary-hover);
    color: #ffffff;
    transform: translateY(-1px);
}

.wpm-product-button:active {
    transform: translateY(0);
}

/* ==========================================================================
   Product Tables - Horizontal Layout
   ========================================================================== */
.wpm-product-table.wpm-layout-horizontal {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wpm-product-table.wpm-layout-horizontal .wpm-product-card {
    display: grid;
    grid-template-columns: 2fr 1fr 3fr 1fr;
    align-items: center;
    padding: 20px 24px;
}

.wpm-product-table.wpm-layout-horizontal .wpm-product-card:hover {
    transform: none;
}

.wpm-product-table.wpm-layout-horizontal .wpm-product-content {
    display: contents;
    padding: 0;
}

.wpm-product-table.wpm-layout-horizontal .wpm-product-title {
    text-align: left;
    margin: 0;
    font-size: 16px;
}

.wpm-product-table.wpm-layout-horizontal .wpm-product-price {
    text-align: center;
    margin: 0;
}

.wpm-product-table.wpm-layout-horizontal .wpm-price-amount {
    font-size: 24px;
}

.wpm-product-table.wpm-layout-horizontal .wpm-price-period {
    display: inline;
    margin-left: 4px;
}

.wpm-product-table.wpm-layout-horizontal .wpm-product-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    padding: 0;
    margin: 0;
    border: none;
}

.wpm-product-table.wpm-layout-horizontal .wpm-product-features li {
    padding: 4px 0;
    font-size: 13px;
}

.wpm-product-table.wpm-layout-horizontal .wpm-product-button {
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
}

.wpm-product-table.wpm-layout-horizontal .wpm-highlight-badge {
    position: static;
    transform: none;
    display: inline-block;
    padding: 4px 10px;
    margin-left: 10px;
    border-radius: 4px;
    font-size: 10px;
}

@media (max-width: 992px) {
    .wpm-product-table.wpm-layout-horizontal .wpm-product-card {
        grid-template-columns: 1fr;
        gap: 16px;
        text-align: center;
    }
    
    .wpm-product-table.wpm-layout-horizontal .wpm-product-title {
        text-align: center;
    }
    
    .wpm-product-table.wpm-layout-horizontal .wpm-product-features {
        justify-content: center;
    }
    
    .wpm-product-table.wpm-layout-horizontal .wpm-product-button {
        width: 100%;
    }
}

/* ==========================================================================
   Domain Tables
   ========================================================================== */
.wpm-domain-table {
    display: grid;
    gap: 20px;
}

.wpm-domain-table.wpm-columns-1 { grid-template-columns: 1fr; }
.wpm-domain-table.wpm-columns-2 { grid-template-columns: repeat(2, 1fr); }
.wpm-domain-table.wpm-columns-3 { grid-template-columns: repeat(3, 1fr); }
.wpm-domain-table.wpm-columns-4 { grid-template-columns: repeat(4, 1fr); }
.wpm-domain-table.wpm-columns-5 { grid-template-columns: repeat(5, 1fr); }
.wpm-domain-table.wpm-columns-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 992px) {
    .wpm-domain-table {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .wpm-domain-table {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .wpm-domain-table {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   Domain Card
   ========================================================================== */
.wpm-domain-card {
    position: relative;
    background: #ffffff;
    border-radius: var(--wpm-table-radius);
    border: 1px solid var(--wpm-table-border);
    box-shadow: var(--wpm-table-shadow);
    padding: 24px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wpm-domain-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

.wpm-domain-card.wpm-featured {
    border-color: var(--wpm-table-primary);
    border-width: 2px;
}

/* Domain Logo */
.wpm-domain-logo {
    width: 80px;
    height: 60px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpm-domain-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.wpm-domain-logo-placeholder {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
}

/* Domain Extension */
.wpm-domain-extension {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 16px;
}

/* Domain Prices */
.wpm-domain-prices {
    margin-bottom: 20px;
}

.wpm-domain-price-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--wpm-table-border);
    font-size: 14px;
}

.wpm-domain-price-row:last-child {
    border-bottom: none;
}

.wpm-domain-price-label {
    color: var(--wpm-table-text-light);
}

.wpm-domain-price-value {
    font-weight: 600;
    color: var(--wpm-table-text);
}

.wpm-domain-price-value.wpm-na {
    color: var(--wpm-table-text-light);
    font-weight: normal;
    font-style: italic;
}

/* Domain Featured Badge */
.wpm-domain-featured-badge {
    position: absolute;
    top: -10px;
    right: 16px;
    padding: 4px 12px;
    background: var(--wpm-table-primary);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 10px;
}

/* Domain Button */
.wpm-domain-button {
    display: inline-block;
    padding: 10px 24px;
    background: var(--wpm-table-primary);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.wpm-domain-button:hover {
    background: var(--wpm-table-primary-hover);
    color: #ffffff;
}

/* ==========================================================================
   Loading State
   ========================================================================== */
.wpm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--wpm-table-text-light);
}

.wpm-loading::after {
    content: "";
    width: 32px;
    height: 32px;
    border: 3px solid var(--wpm-table-border);
    border-top-color: var(--wpm-table-primary);
    border-radius: 50%;
    animation: wpm-spin 0.8s linear infinite;
}

@keyframes wpm-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Error State
   ========================================================================== */
.wpm-error {
    padding: 40px;
    text-align: center;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
    border-radius: var(--wpm-table-radius);
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.wpm-empty {
    padding: 60px 40px;
    text-align: center;
    color: var(--wpm-table-text-light);
    background: #f9fafb;
    border-radius: var(--wpm-table-radius);
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .wpm-product-card,
    .wpm-domain-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .wpm-product-button,
    .wpm-domain-button {
        display: none;
    }
}
