/* Universal Comparison Tables - Frontend Styles */

/* Reset and base styles */
.ucomp-table-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 20px 0;
    font-size: 14px;
}

.ucomp-table-container * {
    box-sizing: border-box;
}

/* Responsive table wrapper */
.ucomp-table-responsive {
    overflow-x: auto;
    margin: 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Table styles */
.ucomp-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin: 0;
    font-size: 14px;
    border-radius: 8px;
    overflow: hidden;
}

.ucomp-table th,
.ucomp-table td {
    padding: 16px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
    vertical-align: top;
}

.ucomp-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
}

.ucomp-table tbody tr:hover {
    background-color: #f8f9fa;
}

.ucomp-table tbody tr:last-child td {
    border-bottom: none;
}

/* Column specific styles */
.ucomp-col-name {
    width: 25%;
    min-width: 200px;
}

.ucomp-col-description {
    width: 30%;
    min-width: 250px;
}

.ucomp-col-price {
    width: 12%;
    min-width: 100px;
    text-align: right;
}

.ucomp-col-rating {
    width: 15%;
    min-width: 120px;
}

.ucomp-col-features {
    width: 25%;
    min-width: 200px;
}

.ucomp-col-bullets {
    width: 20%;
    min-width: 180px;
}

.ucomp-col-cta {
    width: 15%;
    min-width: 120px;
    text-align: center;
}

/* Content styles */
.ucomp-affiliate-name {
    font-weight: 600;
    font-size: 16px;
    color: #2c3e50;
    display: block;
    margin-bottom: 4px;
}

.ucomp-affiliate-description {
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}

.ucomp-affiliate-description p {
    margin: 0 0 8px 0;
}

.ucomp-affiliate-description p:last-child {
    margin-bottom: 0;
}

.ucomp-price {
    font-weight: 700;
    font-size: 18px;
    color: #27ae60;
}

.ucomp-price-na {
    color: #999;
    font-style: italic;
}

/* Rating styles */
.ucomp-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ucomp-stars {
    display: flex;
    gap: 2px;
}

.ucomp-star {
    font-size: 16px;
    line-height: 1;
}

.ucomp-star-full {
    color: #f39c12;
}

.ucomp-star-half {
    color: #f39c12;
}

.ucomp-star-empty {
    color: #ddd;
}

.ucomp-rating-text {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.ucomp-rating-na {
    color: #999;
    font-style: italic;
}

/* Features list */
.ucomp-features {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ucomp-features li {
    padding: 3px 0;
    position: relative;
    font-size: 13px;
    color: #555;
}

.ucomp-features li:before {
    content: "✓";
    color: #27ae60;
    font-weight: bold;
    margin-right: 8px;
}

/* Bullets list */
.ucomp-bullets {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ucomp-bullet {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin: 2px 0;
    display: inline-block;
    margin-right: 4px;
}

/* CTA Button */
.ucomp-cta-button {
    display: inline-block;
    background: #3498db;
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    text-align: center;
    border: 2px solid #3498db;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ucomp-cta-button:hover {
    background: #2980b9;
    border-color: #2980b9;
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.ucomp-cta-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

/* Card Layout */
.ucomp-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin: 20px 0;
}

.ucomp-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.ucomp-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.ucomp-card-header {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    background: #f8f9fa;
}

.ucomp-card-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.3;
}

.ucomp-card-rating {
    margin-top: 8px;
}

.ucomp-card-body {
    padding: 20px;
    flex: 1;
}

.ucomp-card-description {
    margin-bottom: 16px;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.ucomp-card-price {
    margin-bottom: 16px;
    text-align: center;
}

.ucomp-card-price .ucomp-price {
    font-size: 24px;
    color: #27ae60;
    display: block;
}

.ucomp-card-features {
    margin-bottom: 16px;
}

.ucomp-card-features .ucomp-features {
    columns: 1;
}

.ucomp-card-bullets {
    margin-bottom: 16px;
}

.ucomp-card-footer {
    padding: 20px;
    background: #f8f9fa;
    text-align: center;
    border-top: 1px solid #f0f0f0;
}

.ucomp-card-footer .ucomp-cta-button {
    width: 100%;
    display: block;
}

/* Error and notice styles */
.ucomp-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin: 16px 0;
}

.ucomp-notice {
    background: #d1ecf1;
    color: #0c5460;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #bee5eb;
    margin: 16px 0;
}

/* Responsive styles */
@media (max-width: 768px) {
    .ucomp-table-responsive {
        border-radius: 0;
        margin: 0 -16px;
    }
    
    .ucomp-table {
        border-radius: 0;
        font-size: 12px;
    }
    
    .ucomp-table th,
    .ucomp-table td {
        padding: 12px 8px;
    }
    
    .ucomp-affiliate-name {
        font-size: 14px;
    }
    
    .ucomp-price {
        font-size: 16px;
    }
    
    .ucomp-cta-button {
        padding: 10px 16px;
        font-size: 12px;
    }
    
    .ucomp-cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin: 16px 0;
    }
    
    .ucomp-card {
        border-radius: 8px;
    }
    
    .ucomp-card-header,
    .ucomp-card-body,
    .ucomp-card-footer {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    /* Stack table as cards on very small screens */
    .ucomp-layout-table .ucomp-table-responsive {
        overflow: visible;
    }
    
    .ucomp-layout-table .ucomp-table,
    .ucomp-layout-table .ucomp-table thead,
    .ucomp-layout-table .ucomp-table tbody,
    .ucomp-layout-table .ucomp-table th,
    .ucomp-layout-table .ucomp-table td,
    .ucomp-layout-table .ucomp-table tr {
        display: block;
    }
    
    .ucomp-layout-table .ucomp-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .ucomp-layout-table .ucomp-table tr {
        border: 1px solid #ddd;
        margin-bottom: 16px;
        border-radius: 8px;
        overflow: hidden;
        background: #fff;
    }
    
    .ucomp-layout-table .ucomp-table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding: 12px 12px 12px 120px;
    }
    
    .ucomp-layout-table .ucomp-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        width: 100px;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: #555;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .ucomp-layout-table .ucomp-table td:last-child {
        border-bottom: none;
    }
}

/* Accessibility */
.ucomp-table:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .ucomp-card,
    .ucomp-cta-button {
        transition: none;
    }
    
    .ucomp-card:hover {
        transform: none;
    }
    
    .ucomp-cta-button:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ucomp-table {
        border: 2px solid;
    }
    
    .ucomp-table th,
    .ucomp-table td {
        border: 1px solid;
    }
    
    .ucomp-card {
        border: 2px solid;
    }
}

/* Print styles */
@media print {
    .ucomp-table-container {
        box-shadow: none;
    }
    
    .ucomp-card {
        box-shadow: none;
        border: 1px solid #000;
        break-inside: avoid;
    }
    
    .ucomp-cta-button {
        border: 1px solid #000;
        background: none !important;
        color: #000 !important;
    }
}