/* Carico Memberships Frontend Styles */
.carico-pricing-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.carico-pricing-table.columns-1 {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.carico-pricing-table.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.carico-pricing-table.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.carico-pricing-table.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.pricing-plan {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.1);
    padding: 30px;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid transparent;
}

.pricing-plan:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.pricing-plan.current-role {
    border-color: #0073aa;
}

.plan-header {
    text-align: center;
    margin-bottom: 20px;
}

.plan-header h3 {
    margin: 0 0 10px;
    font-size: 24px;
    color: #333;
}

.plan-price {
    margin: 20px 0;
}

.plan-price .currency {
    font-size: 24px;
    vertical-align: top;
    color: #666;
}

.plan-price .amount {
    font-size: 48px;
    font-weight: bold;
    color: #0073aa;
    line-height: 1;
}

.plan-price .period {
    font-size: 16px;
    color: #666;
    display: block;
    margin-top: 5px;
}

.plan-role {
    margin-top: 10px;
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge.shipper {
    background-color: #e8f4fd;
    color: #0073aa;
    border: 1px solid #b6d7f2;
}

.role-badge.carrier {
    background-color: #e8f6ef;
    color: #28a745;
    border: 1px solid #b8e0c9;
}

.role-badge.advertiser {
    background-color: #f9f0ff;
    color: #6f42c1;
    border: 1px solid #d9c6f0;
}

.plan-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 30px;
}

.plan-features li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    position: relative;
    padding-left: 25px;
}

.plan-features li:last-child {
    border-bottom: none;
}

.plan-features li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}

.plan-actions {
    text-align: center;
}

.plan-actions .button {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
}

/* Checkout */
.carico-checkout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    max-width: 1000px;
    margin: 40px auto;
}

@media (max-width: 768px) {
    .carico-checkout {
        grid-template-columns: 1fr;
    }
}

.checkout-summary {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
}

.checkout-summary h2 {
    margin-top: 0;
    color: #333;
}

.membership-details {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.price-display {
    font-size: 36px;
    font-weight: bold;
    color: #0073aa;
    margin: 20px 0;
}

.features-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.features-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.features-list li:last-child {
    border-bottom: none;
}

.checkout-form {
    padding: 30px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

#stripe-checkout {
    margin: 30px 0;
}

#carico-checkout-button {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: 600;
}

.carico-message {
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
}

.carico-message.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.carico-message.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.checkout-terms {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
    color: #666;
}

/* User Subscription */
.carico-user-subscription {
    max-width: 800px;
    margin: 40px auto;
}

.subscription-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.1);
    padding: 30px;
    margin-bottom: 30px;
}

.subscription-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

.subscription-header h2 {
    margin: 0;
}

.subscription-status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.subscription-status.active {
    background-color: #d4edda;
    color: #155724;
}

.subscription-status.canceled,
.subscription-status.past_due,
.subscription-status.unpaid {
    background-color: #f8d7da;
    color: #721c24;
}

.detail-row {
    display: flex;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-row .label {
    font-weight: 600;
    min-width: 150px;
    color: #555;
}

.detail-row .value {
    flex: 1;
}

.subscription-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
}

.subscription-actions .button {
    flex: 1;
    padding: 12px;
}

.invoices-section {
    margin-top: 40px;
}

.invoices-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.invoices-table th,
.invoices-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.invoices-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.invoices-table tr:hover {
    background: #f8f9fa;
}

.invoice-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.invoice-status.paid {
    background-color: #d4edda;
    color: #155724;
}

.invoice-status.open {
    background-color: #fff3cd;
    color: #856404;
}

.invoice-status.void {
    background-color: #f8d7da;
    color: #721c24;
}

/* Payment Messages */
.payment-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.2);
    z-index: 9999;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.payment-message h3 {
    margin-top: 0;
    color: #333;
}

.payment-message.success {
    border-top: 4px solid #28a745;
}

.payment-message.error {
    border-top: 4px solid #dc3545;
}

/* Billing History in Dashboard */
.billing-history {
    margin-top: 40px;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
}

.billing-history table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.billing-history th,
.billing-history td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.billing-history th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.billing-history .status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.billing-history .status.active,
.billing-history .status.paid {
    background-color: #d4edda;
    color: #155724;
}

.billing-history .status.past_due {
    background-color: #fff3cd;
    color: #856404;
}

.billing-history .status.canceled {
    background-color: #f8d7da;
    color: #721c24;
}

.btn-link {
    background: none;
    border: none;
    color: #0073aa;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

.btn-link:hover {
    color: #005a87;
}

/* Responsive */
@media (max-width: 768px) {
    .carico-pricing-table {
        grid-template-columns: 1fr;
    }
    
    .detail-row {
        flex-direction: column;
    }
    
    .detail-row .label {
        min-width: auto;
        margin-bottom: 5px;
    }
    
    .subscription-actions {
        flex-direction: column;
    }
    
    .billing-history table {
        display: block;
        overflow-x: auto;
    }
}

/* Modal Styles */
#carico-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#carico-modal {
    background: white;
    border-radius: 10px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.carico-modal-content {
    position: relative;
    padding: 30px;
}

.carico-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    z-index: 10;
}

.carico-modal-close:hover {
    color: #000;
}

.carico-modal-body {
    padding-top: 10px;
}

/* Login Required Styles */
.carico-login-required,
.carico-checkout-login-required,
.carico-dashboard-login-required,
.carico-no-membership-selected,
.carico-membership-not-found {
    text-align: center;
    padding: 60px 30px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.1);
    max-width: 500px;
    margin: 40px auto;
}

.carico-login-required p,
.carico-checkout-login-required p,
.carico-dashboard-login-required p,
.carico-no-membership-selected p,
.carico-membership-not-found p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

/* No Memberships */
.no-memberships {
    text-align: center;
    padding: 60px 30px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.1);
    margin: 40px 0;
}

.no-memberships p {
    font-size: 18px;
    color: #666;
    margin: 0;
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .carico-pricing-table {
        grid-template-columns: 1fr;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 20px;
    }
    
    .user-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .user-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .tab-navigation ul {
        flex-wrap: wrap;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .plans-grid,
    .upgrade-plans {
        grid-template-columns: 1fr;
    }
    
    .invoices-table,
    .payments-table {
        display: block;
        overflow-x: auto;
    }
    
    #carico-modal {
        width: 95%;
        padding: 15px;
    }
    
    .carico-modal-content {
        padding: 20px;
    }
}

/* Print Styles */
@media print {
    .carico-user-dashboard .user-actions,
    .carico-user-dashboard .subscription-actions,
    .carico-user-dashboard .tab-navigation {
        display: none !important;
    }
    
    .carico-user-dashboard {
        box-shadow: none !important;
        padding: 0 !important;
    }
}