/**
 * Frontend styles for Cart Membership Line Integration
 */

/* Login Required Notices */
.cmli-login-required-notice {
    background-color: #f8f9fa;
    border: 2px solid #00c300;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.cmli-login-required-notice p {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.cmli-login-required-notice .button {
    background-color: #00c300;
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
    margin-top: 10px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.cmli-login-required-notice .button:hover {
    background-color: #00a000;
    color: white;
}

/* LINE Binding Notices */
.cmli-line-binding-notice {
    background-color: #fff3cd;
    border: 2px solid #00c300;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 20px;
    text-align: center;
}

.cmli-line-binding-notice .line-icon {
    width: 32px;
    height: 32px;
    background-color: #00c300;
    border-radius: 50%;
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
}

.cmli-line-binding-notice .line-icon:before {
    content: "L";
    color: white;
    font-weight: bold;
    font-size: 18px;
    display: block;
    text-align: center;
    line-height: 32px;
}

/* Purchase Interval Countdown */
.cmli-purchase-interval-notice {
    background-color: #fff5f5;
    border: 2px solid #e53e3e;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    text-align: center;
    color: #e53e3e;
    font-weight: bold;
}

.cmli-purchase-interval-notice .countdown {
    font-size: 18px;
    color: #c53030;
    font-family: monospace;
}

/* Add to Cart Button Modifications */
.cmli-login-required {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    cursor: not-allowed;
}

.cmli-login-required:hover {
    background-color: #5a6268 !important;
    border-color: #545b62 !important;
}

/* LINE Login/Binding Pages */
.cmli-line-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.cmli-line-page h2 {
    color: #333;
    margin-bottom: 20px;
}

.cmli-line-button {
    background-color: #00c300;
    color: white;
    padding: 0px 12px;
    margin: 0 8px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.cmli-line-button:hover {
    background-color: #00a000;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 195, 0, 0.3);
}

.cmli-line-button.secondary {
    background-color: #6c757d;
}

.cmli-line-button.secondary:hover {
    background-color: #5a6268;
}

/* Line Binding Status */
.cmli-binding-status {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.cmli-binding-status.connected {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.cmli-binding-status.disconnected {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.cmli-binding-status .status-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
}

.cmli-binding-status.connected .status-icon {
    background-color: #28a745;
}

.cmli-binding-status.disconnected .status-icon {
    background-color: #dc3545;
}

.cmli-binding-status .cmli-line-button {
	margin: 10px 0;
}

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

.cmli-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #00c300;
    border-radius: 50%;
    animation: cmli-spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* Success Messages */
.cmli-success-message {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
}

.cmli-success-message .success-icon {
    color: #28a745;
    font-size: 24px;
    margin-right: 10px;
    vertical-align: middle;
}

/* Error Messages */
.cmli-error-message {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
}

.cmli-error-message .error-icon {
    color: #dc3545;
    font-size: 24px;
    margin-right: 10px;
    vertical-align: middle;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cmli-login-required-notice,
    .cmli-line-binding-notice {
        padding: 15px;
        margin-bottom: 15px;
    }

    .cmli-line-page {
        padding: 15px;
    }

    .cmli-line-button {
        padding: 12px 20px;
        font-size: 14px;
        display: block;
        margin: 10px 0;
    }
}

/* Cart/Checkout Protection */
.cmli-protected-content {
    filter: blur(2px);
    pointer-events: none;
    user-select: none;
}

.cmli-protection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cmli-protection-modal {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    margin: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.cmli-protection-modal h3 {
    color: #333;
    margin-bottom: 15px;
}

.cmli-protection-modal p {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Hide elements for non-logged in users */
.cmli-hide-for-guests {
    display: none !important;
}

/* Custom WooCommerce notice styling */
.woocommerce-info.cmli-notice {
    border-top-color: #00c300;
}

.woocommerce-error.cmli-notice {
    border-top-color: #e53e3e;
}

/* LINE LIFF specific styles */
.cmli-liff-container {
    padding: 20px;
    background-color: #f8f9fa;
    min-height: 100vh;
}

.cmli-liff-header {
    text-align: center;
    margin-bottom: 30px;
}

.cmli-liff-header h1 {
    color: #00c300;
    font-size: 24px;
    margin-bottom: 10px;
}

.cmli-liff-content {
    background-color: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.cmli-progress-bar {
    width: 100%;
    height: 6px;
    background-color: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin: 20px 0;
}

.cmli-progress-fill {
    height: 100%;
    background-color: #00c300;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Auto-redirect countdown */
.cmli-redirect-countdown {
    font-size: 18px;
    color: #00c300;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
}

.cmli-redirect-countdown .countdown-number {
    display: inline-block;
    min-width: 30px;
    height: 30px;
    line-height: 30px;
    background-color: #00c300;
    color: white;
    border-radius: 50%;
    font-size: 16px;
    margin: 0 5px;
}

.woocommerce-info, .woocommerce-error, .woocommerce-message, .woocommerce-thankyou-order-received {
	gap: 12px;
}

/* OAuth Binding Button Styles */
.cmli-oauth-bind-button {
    background-color: #00c300;
    color: white;
    padding: 4px 14px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.cmli-oauth-bind-button:hover {
    background-color: #00a000;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 195, 0, 0.3);
}

/* Loading spinner for OAuth buttons */
.cmli-oauth-bind-button.cmli-loading {
    opacity: 0.7;
    pointer-events: none;
}

.cmli-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: cmli-spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

.woocommerce:has(>.woocommerce-cart-notice) .woocommerce-notices-wrapper .woocommerce-cart-notice {
	display: none !important;
}

.woocommerce-cart .woocommerce-notices-wrapper .woocommerce-message {
	width: 100%;
	max-width: 100%;
}