/* ========================================
   Custom Component Extensions for Bulma
   ========================================
   
   This file extends Bulma with project-specific customizations.
   Keep this minimal - prefer Bulma's built-in classes when possible.
*/

/* ========== Design System Variables ========== */
:root {
    /* Colors - softer, lighter palette */
    --color-primary: #7B9DFF;
    --color-primary-hover: #6A8EF5;
    --color-success: #34D399;
    --color-warning: #FBBF24;
    --color-danger: #F87171;
    
    /* Extended neutral colors - lighter tones */
    --color-bg-light: #FAFBFC;
    --color-border-light: #E8EBF0;
    --color-text-primary: #374151;
    --color-text-secondary: #6B7280;
    --color-text-tertiary: #9CA3AF;
    
    /* Spacing extensions (supplement Bulma's spacing) */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    
    /* Shadows - tiered system */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-elevated: 0 4px 12px rgba(0, 0, 0, 0.06);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* ========== Alpine.js Utility ========== */
[x-cloak] {
    display: none !important;
}

/* ========== Card Enhancements ========== */
.box {
    box-shadow: var(--shadow-soft);
    border: 1px solid #EEF1F5;
    background: #FFFFFF;
}

/* Card with full-width grid span */
.box-full {
    grid-column: 1 / -1;
}

/* ========== Button Enhancements ========== */
.button.is-primary {
    background-color: var(--color-primary);
}

.button.is-primary:hover {
    background-color: var(--color-primary-hover);
}

/* Badge-style buttons */
.button.is-badge {
    border-radius: 20px;
    padding-left: 1rem;
    padding-right: 1rem;
    font-size: 0.875rem;
}

/* ========== Progress Bar Styling ========== */
.progress {
    height: 6px;
    border-radius: 10px;
}

.progress::-webkit-progress-bar {
    background-color: #F0F3F7;
}

.progress::-webkit-progress-value {
    background: #7B9DFF;
    border-radius: 10px;
}

.progress::-moz-progress-bar {
    background: #7B9DFF;
    border-radius: 10px;
}

/* ========== Tabs Enhancement ========== */
.tabs {
    background: #F5F7FA;
    padding: 4px;
    border-radius: 8px;
    border-bottom: none;
}

.tabs ul {
    border-bottom: none;
}

.tabs li a {
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    border-radius: 6px;
    transition: all 0.2s;
}

.tabs li.is-active a {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 2px 6px rgba(123, 157, 255, 0.2);
}

/* Tab text responsive behavior */
.tab-text-short {
    display: none;
}

@media screen and (max-width: 768px) {
    .tab-text-full {
        display: none;
    }
    .tab-text-short {
        display: inline;
    }
}

/* ========== Input Enhancements ========== */
.input[readonly].is-family-monospace {
    background-color: var(--color-bg-light);
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    word-break: break-all;
}

.input[readonly]:not(.is-family-monospace) {
    background-color: var(--color-bg-light);
}

/* Ensure inputs in has-addons fields align with buttons */
.field.has-addons .control .input {
    height: 2.5em;
}

.field.has-addons .control .button {
    height: 2.5em;
}

/* ========== Info Display Components ========== */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.info-label {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.info-value {
    font-weight: 500;
    font-size: 0.875rem;
}

/* ========== Stat Display ========== */
.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.stat-value {
    color: var(--color-primary);
    font-weight: 600;
}

/* ========== Invite/Rebate Components ========== */
.rebate-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

.rebate-user {
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rebate-user .icon {
    color: var(--color-primary);
    font-size: 0.375rem;
}

.rebate-amount {
    color: var(--color-success);
    font-weight: 600;
    white-space: nowrap;
}

/* ========== Chart Container ========== */
.chart-wrapper {
    height: 80px;
    position: relative;
}

/* ========== Dashboard Grid Layout ========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media screen and (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* ========== Modal Enhancements ========== */
.modal-card {
    max-width: 400px;
}

.modal .modal-background {
    backdrop-filter: blur(4px);
}

.qr-wrapper {
    display: inline-block;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ========== Utility Classes ========== */
.has-text-primary-custom {
    color: var(--color-primary) !important;
}

.has-text-muted {
    color: var(--color-text-secondary) !important;
}

.has-text-light {
    color: var(--color-text-tertiary) !important;
}

.has-border-light {
    border: 1px solid var(--color-border-light);
}

.has-background-light-custom {
    background-color: var(--color-bg-light) !important;
}

/* Monospace text for code/links */
.is-family-monospace {
    font-family: 'Courier New', monospace;
}

/* ========== iOS-Style Segment Control (Tab Switcher) ========== */
.tab-switcher {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
}

.tab-switcher button {
    padding: 0.5rem 1.5rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tab-switcher button.active {
    background: white;
    color: #667eea;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-switcher .tab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #f5576c;
    color: white;
    font-size: 0.5rem;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 700;
}

@media screen and (max-width: 768px) {
    .tab-switcher button {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
}

/* ========== Pricing Cards ========== */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

@media screen and (max-width: 768px) {
    .pricing-grid {
        grid-template-columns: 1fr;
    }
}

.price-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
}

.price-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.12);
    transform: translateY(-4px);
}

.price-card.featured {
    border-color: #f5576c;
    box-shadow: 0 4px 16px rgba(245, 87, 108, 0.15);
}

.price-card.featured::before {
    content: '推荐';
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f5576c;
    color: white;
    font-size: 0.625rem;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
}

.price-card .card-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

.price-card .card-price-wrapper {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin: 1rem 0;
}

.price-card .price-symbol {
    font-size: 1.125rem;
    color: #6b7280;
    font-weight: 600;
}

.price-card .price-number {
    font-size: 2.25rem;
    font-weight: 800;
    color: #7B9DFF;
    line-height: 1;
}

.price-card .price-unit {
    font-size: 0.875rem;
    color: #9ca3af;
}

.price-card .card-features {
    list-style: none;
    padding: 0;
    margin: 1.25rem 0;
    font-size: 0.875rem;
}

.price-card .card-features li {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #4b5563;
}

.price-card .card-features .icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e0e7ff;
    color: #667eea;
    font-size: 0.625rem;
}

.price-card .card-btn {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #7B9DFF;
    color: white;
}

.price-card .card-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.price-card .card-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.price-card.featured .card-btn {
    background: #f5576c;
}

/* ========== Balance Widget ========== */
.balance-widget {
    background: white;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid #e5e7eb;
    max-width: 100%;
}

.balance-widget > div:first-child {
    min-width: 0;
    flex-shrink: 1;
}

.balance-widget .balance-label {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.125rem;
    white-space: nowrap;
}

.balance-widget .balance-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #7B9DFF;
    word-break: break-all;
    line-height: 1.2;
}

@media screen and (max-width: 768px) {
    .balance-widget {
        width: 100%;
        justify-content: space-between;
    }
    
    .balance-widget .balance-value {
        font-size: 1.25rem;
    }
}

/* ========== Info Banner ========== */
.info-banner {
    background: #eff6ff;
    border-left: 3px solid #7B9DFF;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #1e40af;
}

/* ========== Section Divider ========== */
.section-divider {
    margin: 2.5rem 0 1.5rem 0;
    text-align: center;
}

.section-divider .section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    display: inline-block;
    position: relative;
    padding-bottom: 0.5rem;
}

.section-divider .section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background: #7B9DFF;
}

/* ========== Data Table ========== */
.data-table {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.data-table table {
    margin-bottom: 0;
}

.data-table thead {
    background: #f9fafb;
}

.data-table th {
    color: #6b7280;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.data-table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}

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

.data-table tbody tr:hover {
    background: #f9fafb;
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.875rem;
}

/* ========== Modal Tabs ========== */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.modal-tabs button {
    flex: 1;
    padding: 0.875rem;
    border: none;
    background: none;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.modal-tabs button.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* ========== Responsive Spacing ========== */
@media screen and (max-width: 768px) {
    .box {
        padding: 1rem;
    }
    
    .section {
        padding: 1.5rem 1rem;
    }
}

