/* Group Buying WooCommerce Frontend Styles */

/* Notices */
.gbw-notice {
    padding: 12px 16px;
    margin: 10px 0;
    border-radius: 4px;
    font-weight: 500;
    position: relative;
    z-index: 1000;
}

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

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

.gbw-notice-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Program Display */
.gbw-program-display {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Program Header */
.gbw-program-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.gbw-status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
}

.gbw-status-active {
    background: #46b450;
    color: white;
}

.gbw-status-inactive {
    background: #ffb900;
    color: white;
}

.gbw-status-expired {
    background: #dc3232;
    color: white;
}

.gbw-status-completed {
    background: #00a0d2;
    color: white;
}

.gbw-countdown {
    text-align: right;
}

.gbw-countdown-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.gbw-countdown-time {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #dc3232;
}

.gbw-countdown.gbw-expired .gbw-countdown-time {
    color: #999;
}

/* Program Details */
.gbw-program-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.gbw-detail-item {
    display: flex;
    flex-direction: column;
}

.gbw-detail-item strong {
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.gbw-detail-item span {
    color: #666;
    font-size: 16px;
}

/* Products Section */
.gbw-products-section {
    margin-bottom: 30px;
}

.gbw-products-section h3 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.gbw-products-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.gbw-product-item {
    display: grid;
    grid-template-columns: 100px 1fr auto auto;
    gap: 20px;
    align-items: center;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.gbw-product-item:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: #0073aa;
}

.gbw-product-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.gbw-product-info {
    flex: 1;
}

.gbw-product-title {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.gbw-product-title a {
    color: #333;
    text-decoration: none;
}

.gbw-product-title a:hover {
    color: #0073aa;
}

.gbw-product-price {
    margin-bottom: 10px;
}

.gbw-program-price {
    font-size: 20px;
    font-weight: bold;
    color: #0073aa;
}

.gbw-regular-price {
    font-size: 16px;
    color: #999;
    text-decoration: line-through;
    margin-left: 10px;
}

.gbw-savings {
    font-size: 14px;
    color: #46b450;
    font-weight: bold;
    margin-left: 10px;
}

.gbw-unit {
    font-size: 14px;
    color: #666;
}

.gbw-product-description {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

/* Quantity Input */
.gbw-product-quantity {
    text-align: center;
}

.gbw-product-quantity label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #333;
}

.gbw-quantity-input {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.gbw-qty-minus,
.gbw-qty-plus {
    background: #f0f0f0;
    border: none;
    width: 30px;
    height: 40px;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    transition: background 0.3s ease;
}

.gbw-qty-minus:hover,
.gbw-qty-plus:hover {
    background: #e0e0e0;
}

.gbw-qty-input {
    width: 80px;
    height: 40px;
    border: none;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
}

.gbw-unit-label {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* Actions Section */
.gbw-actions {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
    margin-top: 30px;
}

.gbw-total-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    border: 2px solid #0073aa;
}

.gbw-total-quantity,
.gbw-total-amount {
    text-align: center;
}

.gbw-total-quantity strong,
.gbw-total-amount strong {
    display: block;
    color: #333;
    margin-bottom: 5px;
}

.gbw-total-qty,
.gbw-total-price {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
}

.gbw-minimum-notice {
    text-align: center;
    padding: 15px;
    background: #e7f3ff;
    border: 1px solid #0073aa;
    border-radius: 4px;
    color: #0073aa;
    font-weight: bold;
}

.gbw-minimum-notice.gbw-error {
    background: #ffe7e7;
    border-color: #dc3232;
    color: #dc3232;
    animation: gbw-pulse 1s ease-in-out;
}

@keyframes gbw-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.gbw-action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Buttons */
.gbw-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.gbw-btn:disabled,
.gbw-btn.disabled-exceeded {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #ccc !important;
    color: #666 !important;
}

.gbw-buy-now-btn:disabled,
.gbw-buy-now-btn.disabled-exceeded,
.gbw-add-to-cart-btn:disabled,
.gbw-add-to-cart-btn.disabled-exceeded {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #ccc !important;
    color: #666 !important;
    pointer-events: none;
}

.gbw-btn-primary {
    background: #0073aa;
    color: white;
}

.gbw-btn-primary:hover:not(:disabled) {
    background: #005a87;
    transform: translateY(-2px);
}

.gbw-btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

.gbw-btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
    border-color: #ccc;
}

.gbw-btn-add-to-cart {
    background: #46b450;
    color: white;
}

.gbw-btn-add-to-cart:hover:not(:disabled) {
    background: #3a9940;
}

/* Share Section */
.gbw-share-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #ddd;
}

.gbw-share-section h4 {
    margin-bottom: 15px;
    color: #333;
}

.gbw-share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gbw-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    background: #fff;
    font-size: 14px;
    transition: all 0.3s ease;
}

.gbw-share-btn:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.gbw-share-facebook {
    border-color: #1877f2;
    color: #1877f2;
}

.gbw-share-facebook:hover {
    background: #1877f2;
    color: white;
}

.gbw-share-zalo {
    border-color: #0068ff;
    color: #0068ff;
}

.gbw-share-zalo:hover {
    background: #0068ff;
    color: white;
}

/* Program Grid (for shortcodes) */
.gbw-programs-grid {
    display: grid;
    gap: 30px;
    margin-bottom: 30px;
}

.gbw-columns-1 { grid-template-columns: 1fr; }
.gbw-columns-2 { grid-template-columns: repeat(2, 1fr); }
.gbw-columns-3 { grid-template-columns: repeat(3, 1fr); }
.gbw-columns-4 { grid-template-columns: repeat(4, 1fr); }

.gbw-program-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.gbw-program-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-5px);
}

.gbw-program-image {
    position: relative;
    overflow: hidden;
}

.gbw-program-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gbw-program-card:hover .gbw-program-image img {
    transform: scale(1.05);
}

.gbw-program-badge {
    position: absolute;
    top: 10px;
    left: 10px;
}

.gbw-program-countdown {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.gbw-program-content {
    padding: 20px;
}

.gbw-program-title {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.gbw-program-title a {
    color: #333;
    text-decoration: none;
}

.gbw-program-title a:hover {
    color: #0073aa;
}

.gbw-program-excerpt {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 15px;
}

.gbw-program-price {
    margin-bottom: 15px;
}

.gbw-price {
    font-size: 20px;
    font-weight: bold;
    color: #0073aa;
}

.gbw-program-details {
    margin-bottom: 15px;
}

.gbw-detail-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 14px;
}

.gbw-label {
    color: #666;
}

.gbw-value {
    font-weight: bold;
    color: #333;
}

.gbw-program-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.gbw-stat-item {
    text-align: center;
}

.gbw-stat-label {
    display: block;
    font-size: 12px;
    color: #666;
}

.gbw-stat-value {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: #0073aa;
}

.gbw-program-actions {
    display: flex;
    gap: 10px;
}

.gbw-program-actions .gbw-btn {
    flex: 1;
    justify-content: center;
    padding: 10px 15px;
    font-size: 14px;
}

/* Notices */
.gbw-notice {
    padding: 15px;
    margin-bottom: 20px;
    border-left: 4px solid #0073aa;
    background: #f0f8ff;
    border-radius: 4px;
}

.gbw-notice-error {
    border-left-color: #dc3232;
    background: #ffe7e7;
    color: #dc3232;
}

.gbw-notice-success {
    border-left-color: #46b450;
    background: #e7f5e7;
    color: #46b450;
}

.gbw-notice-warning {
    border-left-color: #ffb900;
    background: #fff8e1;
    color: #f57c00;
}

/* Statistics Widgets */
.gbw-summary-stats,
.gbw-program-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.gbw-stat-item {
    text-align: center;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.gbw-stat-number {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 5px;
}

.gbw-stat-label {
    font-size: 14px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gbw-program-display {
        padding: 15px;
    }
    
    .gbw-program-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .gbw-program-details {
        grid-template-columns: 1fr;
    }
    
    .gbw-product-item {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .gbw-total-summary {
        grid-template-columns: 1fr;
    }
    
    .gbw-action-buttons {
        flex-direction: column;
    }
    
    .gbw-programs-grid {
        grid-template-columns: 1fr !important;
    }
    
    .gbw-program-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .gbw-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .gbw-share-buttons {
        justify-content: center;
    }
    
    .gbw-quantity-input {
        width: 100%;
        max-width: 150px;
        margin: 0 auto;
    }
}

/* Loading States */
.gbw-loading {
    opacity: 0.6;
    pointer-events: none;
}

.gbw-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* New Elements for Enhanced Features */
.gbw-need-more-item {
    color: #dc3232;
    font-weight: bold;
}

.gbw-need-more-item .title {
    color: #dc3232;
}

.gbw-total-weight {
    color: #0073aa;
    font-weight: bold;
}

.gbw-total-savings {
    color: #46b450;
    font-weight: bold;
}

.gbw-unit-price {
    color: #333;
    font-weight: bold;
}

/* Register Notification Button */
.gbw-register-notification {
    background: #ff9800;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.gbw-register-notification:hover:not(:disabled) {
    background: #f57c00;
    transform: translateY(-2px);
}

.gbw-register-notification:disabled,
.gbw-register-notification.registered {
    background: #4caf50;
    cursor: not-allowed;
    opacity: 0.8;
}

.gbw-register-notification.registered:hover {
    transform: none;
}

/* Disabled buttons when exceeding program capacity */
.gbw-buy-now-btn.disabled-exceeded,
.gbw-add-to-cart-btn.disabled-exceeded {
    background-color: #dc3545 !important;
    color: white !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
    pointer-events: none !important;
}

.gbw-buy-now-btn.disabled-exceeded:hover,
.gbw-add-to-cart-btn.disabled-exceeded:hover {
    background-color: #dc3545 !important;
    transform: none !important;
}

.gbw-buy-now-btn.disabled-exceeded::after,
.gbw-add-to-cart-btn.disabled-exceeded::after {
    content: " (Vượt quá giới hạn)";
    font-size: 0.8em;
    opacity: 0.8;
}


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

/* Print Styles */
/* Load More Deals Functionality */
.gbw-load-more-deals {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.gbw-load-more-deals:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.gbw-load-more-deals .icon i.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress bar for sell-line */
.sell-line .progress-bar {
    width: 100%;
    height: 4px;
    background-color: #e0e0e0;
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
}

.sell-line .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Message styles for AJAX responses */
.gbw-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
}

.gbw-message-success {
    background-color: #4CAF50;
}

.gbw-message-error {
    background-color: #f44336;
}

.gbw-message-info {
    background-color: #2196F3;
}

/* Countdown timer styles for new items */
.countdown {
    display: flex;
    gap: 5px;
    font-weight: bold;
    color: #e74c3c;
}

.countdown span {
    background: rgba(231, 76, 60, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Loading animation for new items */
.product-item-sale {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gbw-message {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media print {
    .gbw-action-buttons,
    .gbw-share-section,
    .gbw-load-more-deals {
        display: none !important;
    }

    .gbw-program-display {
        box-shadow: none;
        border: 1px solid #000;
    }
}
