/* ==========================================================================
   Kaxuanguan Redirect & Compare Page Styling
   ========================================================================== */

:root {
    --compare-primary: #3b6fff;
    --compare-primary-hover: #2a5adb;
    --compare-success: #10b981;
    --compare-warning: #f59e0b;
    --compare-border: #e2e8f0;
    --compare-bg-light: #f8fafc;
    --compare-text-main: #1e293b;
    --compare-text-muted: #64748b;
}

/* ==========================================================================
   Redirect Transition Page
   ========================================================================== */
.redirect-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 180px);
    padding: 2rem 1rem;
    background: radial-gradient(circle at top, #f0f4ff 0%, #f8fafc 100%);
}

.redirect-card {
    background: #ffffff;
    border-radius: 1.25rem;
    box-shadow: 0 10px 25px -5px rgba(59, 111, 255, 0.1), 0 8px 10px -6px rgba(59, 111, 255, 0.05);
    padding: 2.5rem;
    width: 100%;
    max-width: 480px;
    text-align: center;
    border: 1px solid rgba(59, 111, 255, 0.1);
}

.redirect-shield {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--compare-success);
    border-radius: 50%;
    margin-bottom: 1.5rem;
    animation: shieldPulse 2s infinite ease-in-out;
}

.redirect-shield svg {
    width: 36px;
    height: 36px;
}

.redirect-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--compare-text-main);
    margin-bottom: 0.5rem;
}

.redirect-subtitle {
    font-size: 0.95rem;
    color: var(--compare-text-muted);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.text-operator {
    color: var(--compare-primary);
    font-weight: 600;
}

/* Countdown Loader */
.redirect-timer-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.redirect-circle-loader {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: conic-gradient(var(--compare-primary) 0%, #e2e8f0 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rotateConic 2s linear;
}

.redirect-circle-loader::before {
    content: '';
    position: absolute;
    width: 82px;
    height: 82px;
    border-radius: 50%;
    background: #ffffff;
}

.redirect-circle-inner {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: baseline;
    color: var(--compare-primary);
}

.redirect-number {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
}

.redirect-sec {
    font-size: 1rem;
    font-weight: 600;
    margin-left: 2px;
}

/* Package Metadata summary */
.redirect-pkg-summary {
    background: var(--compare-bg-light);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 2rem;
    border: 1px solid var(--compare-border);
}

.r-pkg-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--compare-text-main);
    margin-bottom: 0.75rem;
}

.r-pkg-specs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.spec-tag {
    background: #ffffff;
    border: 1px solid var(--compare-border);
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--compare-text-muted);
}

.spec-tag.text-primary {
    color: var(--compare-primary);
    border-color: rgba(59, 111, 255, 0.2);
    background: rgba(59, 111, 255, 0.02);
}

.r-pkg-price {
    color: #ef4444;
    font-weight: 700;
}

.price-symbol {
    font-size: 0.9rem;
}

.price-val {
    font-size: 1.5rem;
}

.price-unit {
    font-size: 0.85rem;
    font-weight: normal;
    color: var(--compare-text-muted);
}

/* Notice List */
.redirect-notice {
    text-align: left;
    background: #fffbef;
    border: 1px solid #fef3c7;
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 2rem;
}

.redirect-notice h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 0.5rem;
}

.redirect-notice ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.redirect-notice li {
    font-size: 0.825rem;
    color: #b45309;
    line-height: 1.6;
    position: relative;
    padding-left: 14px;
    margin-bottom: 4px;
}

.redirect-notice li::before {
    content: "•";
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Button */
.redirect-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: var(--compare-primary);
    color: #ffffff;
    padding: 0.85rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(59, 111, 255, 0.2);
}

.redirect-btn:hover {
    background: var(--compare-primary-hover);
    color: #ffffff;
}

.redirect-btn.pulse {
    animation: buttonPulse 1.5s infinite ease-in-out;
}

/* Animations */
@keyframes shieldPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
}

@keyframes rotateConic {
    from { background: conic-gradient(var(--compare-primary) 0%, #e2e8f0 0%); }
    to { background: conic-gradient(var(--compare-primary) 100%, #e2e8f0 100%); }
}

@keyframes buttonPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); box-shadow: 0 6px 15px -1px rgba(59, 111, 255, 0.4); }
}


/* ==========================================================================
   Compare Page
   ========================================================================== */
.compare-hero {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #ffffff;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.compare-breadcrumb {
    display: flex;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 1rem;
}

.compare-breadcrumb a {
    color: rgba(255, 255, 255, 0.6);
}

.compare-breadcrumb a:hover {
    color: #ffffff;
}

.compare-hero-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.compare-hero-sub {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
}

.compare-section {
    padding-bottom: 4rem;
}

/* Empty State */
.compare-empty-state {
    text-align: center;
    padding: 5rem 2rem;
    background: #ffffff;
    border-radius: 1rem;
    border: 1px dashed var(--compare-border);
}

.compare-empty-state .empty-icon {
    font-size: 4rem;
    color: var(--compare-primary);
    opacity: 0.4;
    margin-bottom: 1.5rem;
}

.compare-empty-state h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--compare-text-main);
    margin-bottom: 0.5rem;
}

.compare-empty-state p {
    color: var(--compare-text-muted);
    margin-bottom: 2rem;
}

.empty-btn {
    display: inline-flex;
    align-items: center;
    background: var(--compare-primary);
    color: #ffffff;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.empty-btn:hover {
    background: var(--compare-primary-hover);
    color: #ffffff;
}

/* Compare Table Wrapper */
.compare-wrapper {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--compare-border);
    overflow: hidden;
    padding: 1rem;
}

.compare-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.compare-table th, 
.compare-table td {
    padding: 1.25rem;
    text-align: center;
    border-bottom: 1px solid var(--compare-border);
}

/* Features (Leftmost Column) */
.cell-feature {
    width: 180px;
    font-weight: 700;
    color: var(--compare-text-main);
    text-align: left !important;
    background: var(--compare-bg-light);
    border-right: 1px solid var(--compare-border);
    position: sticky;
    left: 0;
    z-index: 10;
}

.feature-title {
    font-size: 0.95rem;
}

/* Product columns */
.cell-product {
    min-width: 250px;
    background: #ffffff;
    vertical-align: top;
    position: relative;
}

.prod-header {
    padding-top: 1rem;
    position: relative;
}

.btn-remove-column {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--compare-bg-light);
    border: 1px solid var(--compare-border);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--compare-text-muted);
    transition: all 0.2s ease;
}

.btn-remove-column:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
}

.prod-operator-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.75rem;
    background: var(--compare-bg-light);
    border-radius: 100px;
    border: 1px solid var(--compare-border);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.prod-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--compare-text-main);
    line-height: 1.4;
}

/* Row Styling */
.row-highlight {
    background-color: rgba(59, 111, 255, 0.02);
}

.compare-table tr:hover td {
    background-color: rgba(59, 111, 255, 0.01);
}

.compare-table tr:hover td.cell-feature {
    background-color: #f1f5f9;
}

.cell-val {
    color: var(--compare-text-main);
    font-size: 0.95rem;
}

/* Action row */
.row-actions td {
    border-bottom: none;
    padding: 1.75rem 1rem;
}

.compare-apply-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--compare-primary);
    color: #ffffff;
    padding: 0.65rem 2rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(59, 111, 255, 0.2);
    width: 80%;
}

.compare-apply-btn:hover {
    background: var(--compare-primary-hover);
    color: #ffffff;
    transform: translateY(-1px);
}

.compare-detail-link {
    font-size: 0.825rem;
    color: var(--compare-primary);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.compare-detail-link:hover {
    color: var(--compare-primary-hover);
}

/* Footer clear/back actions */
.compare-footer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--compare-border);
}

.btn-back-list {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    color: var(--compare-text-muted);
}

.btn-back-list:hover {
    color: var(--compare-primary);
}

.btn-clear-compare {
    background: none;
    border: 1px solid var(--compare-border);
    color: var(--compare-text-muted);
    padding: 0.5rem 1.25rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-clear-compare:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
}

/* ==========================================================================
   Compare Floating Drawer / Tray
   ========================================================================== */
.compare-tray {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--compare-border);
    z-index: 999;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 1rem 0;
}

.compare-tray.is-active {
    transform: translateY(0);
}

.compare-tray-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.compare-tray-products {
    display: flex;
    gap: 1.5rem;
    flex-grow: 1;
}

.tray-prod-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--compare-bg-light);
    border: 1px solid var(--compare-border);
    padding: 6px 12px;
    border-radius: 8px;
    position: relative;
    max-width: 200px;
    white-space: nowrap;
}

.tray-prod-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--compare-text-main);
    overflow: hidden;
    text-overflow: ellipsis;
}

.tray-prod-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--compare-text-muted);
    font-size: 14px;
    padding: 0;
    display: flex;
    align-items: center;
}

.tray-prod-remove:hover {
    color: #ef4444;
}

.compare-tray-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-tray-compare {
    background: var(--compare-primary);
    color: #ffffff;
    padding: 0.65rem 1.75rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 6px rgba(59, 111, 255, 0.2);
}

.btn-tray-compare:hover {
    background: var(--compare-primary-hover);
    color: #ffffff;
}

.btn-tray-clear {
    background: none;
    border: none;
    color: var(--compare-text-muted);
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-tray-clear:hover {
    color: #ef4444;
}

/* Compare checkbox overlay styles */
.compare-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.825rem;
    color: var(--compare-text-muted);
    user-select: none;
}

.compare-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--compare-primary);
}

/* Add compare button inside card */
.pc-compare-wrap {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
}

/* Responsive adjustment */
@media (max-width: 768px) {
    .compare-tray {
        bottom: calc(48px + env(safe-area-inset-bottom)) !important;
        transform: translateY(250%);
        padding: 0.6rem 0;
    }
    .compare-tray.is-active {
        transform: translateY(0);
    }
    .compare-tray-products {
        display: none; /* Hide product names on mobile tray to save space */
    }
    .compare-tray-inner {
        flex-direction: row !important;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
    }
    .compare-tray-inner h4 {
        font-size: 0.85rem !important;
    }
    .compare-tray-inner p {
        display: none !important; /* Hide subtitle on mobile to save height */
    }
    .compare-tray-actions {
        gap: 0.5rem !important;
    }
    .btn-tray-compare {
        padding: 0.45rem 0.9rem !important;
        font-size: 0.8rem !important;
        border-radius: 4px !important;
    }
    .btn-tray-clear {
        font-size: 0.8rem !important;
    }
    
    .cell-feature {
        width: 110px;
        font-size: 0.85rem;
        padding: 0.75rem 0.5rem;
    }
    
    .compare-table th, 
    .compare-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
    .prod-name {
        font-size: 0.95rem;
    }
}

/* ==========================================================================
   Packages Filter Toolbar Styling
   ========================================================================== */
.pkg-filter-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pkg-filter-nav {
    flex-grow: 1;
}

.pkg-filter-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.pkg-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--compare-border);
    border-radius: 6px;
    padding-right: 2.5rem;
    width: 240px;
    height: 38px;
    transition: all 0.2s ease;
}

.pkg-search-input-wrap:focus-within {
    border-color: var(--compare-primary);
    box-shadow: 0 0 0 3px rgba(59, 111, 255, 0.1);
}

.pkg-search-input-wrap input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    color: var(--compare-text-main);
    outline: none;
}

.pkg-search-btn {
    position: absolute;
    right: 0;
    top: 0;
    width: 2.5rem;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--compare-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pkg-search-btn:hover {
    color: var(--compare-primary);
}

.pkg-sort-wrap {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--compare-border);
    border-radius: 6px;
    height: 38px;
    width: 160px;
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    transition: all 0.2s ease;
}

.pkg-sort-wrap:focus-within {
    border-color: var(--compare-primary);
    box-shadow: 0 0 0 3px rgba(59, 111, 255, 0.1);
}

.pkg-sort-wrap select {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: var(--compare-text-main);
    outline: none;
    cursor: pointer;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .pkg-filter-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        margin-top: 1rem;
    }
    
    .pkg-filter-actions {
        width: 100%;
        gap: 0.75rem;
    }
    
    .pkg-search-form {
        flex-grow: 1;
        flex-shrink: 1;
    }
    
    .pkg-search-input-wrap {
        width: 100%;
    }
    
    .pkg-sort-wrap {
        flex-grow: 1;
        flex-shrink: 1;
        width: auto;
    }
}

