/* Merupakan Commerce Frontend Styles */
/* Note: Most styling will be done via Tailwind CSS in theme */

/*
 * Color Scheme CSS Variables (auto-generated from settings)
 * These are injected in wp_head via plugin
 *
 * Available variables:
 * --color-primary, --color-primary-rgb
 * --color-primary-dark, --color-primary-dark-rgb
 * --color-secondary, --color-secondary-rgb
 * --color-accent, --color-accent-rgb
 * --color-success, --color-success-rgb
 * --color-warning, --color-warning-rgb
 * --color-danger, --color-danger-rgb
 * --color-background, --color-background-rgb
 * --color-surface, --color-surface-rgb
 * --color-border, --color-border-rgb
 * --color-text, --color-text-rgb
 * --color-text-muted, --color-text-muted-rgb
 *
 * Usage with Tailwind (in tailwind.config.js):
 * theme: {
 *   extend: {
 *     colors: {
 *       primary: 'var(--color-primary)',
 *       'primary-dark': 'var(--color-primary-dark)',
 *       secondary: 'var(--color-secondary)',
 *       accent: 'var(--color-accent)',
 *       success: 'var(--color-success)',
 *       warning: 'var(--color-warning)',
 *       danger: 'var(--color-danger)',
 *     }
 *   }
 * }
 *
 * Or use directly in CSS:
 * .btn-primary { background-color: var(--color-primary); }
 * .btn-primary:hover { background-color: var(--color-primary-dark); }
 *
 * For rgba with opacity:
 * background-color: rgba(var(--color-primary-rgb), 0.5);
 */

/* Utility classes using CSS variables */
.bg-primary { background-color: var(--color-primary); }
.bg-primary-dark { background-color: var(--color-primary-dark); }
.bg-secondary { background-color: var(--color-secondary); }
.bg-accent { background-color: var(--color-accent); }
.bg-success { background-color: var(--color-success); }
.bg-warning { background-color: var(--color-warning); }
.bg-danger { background-color: var(--color-danger); }
.bg-surface { background-color: var(--color-surface); }

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.text-muted { color: var(--color-text-muted); }

.border-primary { border-color: var(--color-primary); }
.border-secondary { border-color: var(--color-secondary); }
.border-default { border-color: var(--color-border); }

.ecomm-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.ecomm-product-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.ecomm-product-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ecomm-product-image {
    aspect-ratio: 1;
    overflow: hidden;
}

.ecomm-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ecomm-product-info {
    padding: 15px;
}

.ecomm-product-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px;
}

.ecomm-product-price {
    font-size: 18px;
    font-weight: 700;
    color: #dc2626;
}

.ecomm-product-price-sale {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 14px;
    margin-right: 8px;
}

.ecomm-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
}

.ecomm-btn-primary {
    background: #2563eb;
    color: #fff;
}

.ecomm-btn-primary:hover {
    background: #1d4ed8;
}

.ecomm-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc2626;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ecomm-variation-selector {
    margin: 15px 0;
}

.ecomm-variation-btn {
    display: inline-block;
    padding: 8px 16px;
    margin: 4px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.ecomm-variation-btn:hover,
.ecomm-variation-btn.active {
    border-color: #2563eb;
    background: #eff6ff;
}

.ecomm-variation-btn.out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: line-through;
}

.ecomm-qty-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ecomm-qty-input button {
    width: 36px;
    height: 36px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 18px;
}

.ecomm-qty-input input {
    width: 60px;
    height: 36px;
    text-align: center;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

/* Cart */
.ecomm-cart-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.ecomm-cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
}

.ecomm-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Order status */
.ecomm-order-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}

.ecomm-status-pending { background: #fef3c7; color: #92400e; }
.ecomm-status-paid { background: #d1fae5; color: #065f46; }
.ecomm-status-shipped { background: #e0e7ff; color: #3730a3; }
.ecomm-status-delivered { background: #d1fae5; color: #065f46; }

/* ============ AUTH STYLES ============ */

.ecomm-auth-container {
    max-width: 420px;
    margin: 40px auto;
    padding: 0 15px;
}

.ecomm-auth-box {
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.ecomm-auth-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text, #1e293b);
    margin: 0 0 24px;
    text-align: center;
}

.ecomm-auth-subtitle {
    font-size: 14px;
    color: var(--color-text-muted, #64748b);
    text-align: center;
    margin-bottom: 20px;
}

.ecomm-auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    margin: -30px -30px 24px;
    padding: 0;
}

.ecomm-auth-tab {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted, #64748b);
    cursor: pointer;
    transition: all 0.2s;
}

.ecomm-auth-tab:first-child {
    border-radius: 12px 0 0 0;
}

.ecomm-auth-tab:last-child {
    border-radius: 0 12px 0 0;
}

.ecomm-auth-tab.active {
    color: var(--color-primary, #2563eb);
    border-bottom-color: var(--color-primary, #2563eb);
}

.ecomm-auth-tab:hover:not(.active) {
    background: var(--color-surface, #f8fafc);
}

.ecomm-auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ecomm-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ecomm-form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text, #1e293b);
}

.ecomm-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.ecomm-input:focus {
    outline: none;
    border-color: var(--color-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb, 37, 99, 235), 0.1);
}

.ecomm-input-pin,
.ecomm-input-otp {
    letter-spacing: 8px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
}

.ecomm-hint {
    font-size: 12px;
    color: var(--color-text-muted, #64748b);
}

.ecomm-btn-block {
    width: 100%;
    text-align: center;
}

.ecomm-btn-outline {
    background: transparent;
    border: 1px solid var(--color-border, #e5e7eb);
    color: var(--color-text, #1e293b);
}

.ecomm-btn-outline:hover {
    background: var(--color-surface, #f8fafc);
    border-color: var(--color-primary, #2563eb);
}

.ecomm-btn-secondary {
    background: var(--color-secondary, #64748b);
    color: #fff;
}

.ecomm-btn-secondary:hover {
    opacity: 0.9;
}

.ecomm-btn-link {
    background: none;
    border: none;
    color: var(--color-primary, #2563eb);
    cursor: pointer;
    padding: 8px 0;
    font-size: 14px;
}

.ecomm-btn-link:hover {
    text-decoration: underline;
}

.ecomm-login-methods {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.ecomm-otp-sent {
    background: rgba(var(--color-success-rgb, 16, 185, 129), 0.1);
    color: var(--color-success, #10b981);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    margin-bottom: 16px;
}

.ecomm-auth-hint {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted, #64748b);
    margin-top: 8px;
}

.ecomm-auth-hint a {
    color: var(--color-primary, #2563eb);
    text-decoration: none;
}

.ecomm-auth-hint a:hover {
    text-decoration: underline;
}

.ecomm-auth-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border, #e5e7eb);
    text-align: center;
    font-size: 14px;
    color: var(--color-text-muted, #64748b);
}

.ecomm-auth-footer a {
    color: var(--color-primary, #2563eb);
    text-decoration: none;
    font-weight: 500;
}

.ecomm-auth-footer a:hover {
    text-decoration: underline;
}

.ecomm-auth-loading {
    text-align: center;
    padding: 40px 20px;
}

.ecomm-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border, #e5e7eb);
    border-top-color: var(--color-primary, #2563eb);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: ecomm-spin 0.8s linear infinite;
}

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

.ecomm-auth-logged-in {
    text-align: center;
    padding: 40px 20px;
}

.ecomm-auth-logged-in p {
    margin-bottom: 16px;
    color: var(--color-text, #1e293b);
}

/* ============ ACCOUNT STYLES ============ */

.ecomm-account-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ecomm-account-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--color-surface, #f8fafc);
    border-radius: 12px;
    margin-bottom: 24px;
}

.ecomm-account-avatar {
    width: 64px;
    height: 64px;
    background: var(--color-primary, #2563eb);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
}

.ecomm-account-info h2 {
    margin: 0 0 4px;
    font-size: 20px;
    color: var(--color-text, #1e293b);
}

.ecomm-account-info p {
    margin: 0;
    color: var(--color-text-muted, #64748b);
    font-size: 14px;
}

.ecomm-account-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.ecomm-stat-card {
    background: var(--color-surface, #f8fafc);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.ecomm-stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary, #2563eb);
}

.ecomm-stat-label {
    font-size: 12px;
    color: var(--color-text-muted, #64748b);
}

.ecomm-account-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.ecomm-account-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-text, #1e293b);
    transition: all 0.2s;
}

.ecomm-account-menu-item:hover {
    border-color: var(--color-primary, #2563eb);
    background: rgba(var(--color-primary-rgb, 37, 99, 235), 0.05);
}

.ecomm-menu-icon {
    font-size: 20px;
}

.ecomm-account-section {
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
}

.ecomm-account-section h3 {
    margin: 0 0 20px;
    font-size: 18px;
    color: var(--color-text, #1e293b);
}

.ecomm-account-section h4 {
    margin: 24px 0 16px;
    font-size: 16px;
    color: var(--color-text, #1e293b);
}

.ecomm-divider {
    border: none;
    border-top: 1px solid var(--color-border, #e5e7eb);
    margin: 24px 0;
}

.ecomm-empty {
    text-align: center;
    color: var(--color-text-muted, #64748b);
    padding: 24px;
}

/* Orders list */
.ecomm-orders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ecomm-order-item {
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 8px;
    padding: 16px;
}

.ecomm-order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ecomm-order-id {
    font-weight: 600;
    color: var(--color-text, #1e293b);
}

.ecomm-order-details {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--color-text-muted, #64748b);
}

.ecomm-order-total {
    font-weight: 600;
    color: var(--color-text, #1e293b);
}

/* Coins list */
.ecomm-coins-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ecomm-coin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--color-surface, #f8fafc);
    border-radius: 8px;
}

.ecomm-coin-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ecomm-coin-desc {
    font-size: 14px;
    color: var(--color-text, #1e293b);
}

.ecomm-coin-date {
    font-size: 12px;
    color: var(--color-text-muted, #64748b);
}

.ecomm-coin-amount {
    font-weight: 700;
    font-size: 16px;
}

.ecomm-coin-amount.positive {
    color: var(--color-success, #10b981);
}

.ecomm-coin-amount.negative {
    color: var(--color-danger, #ef4444);
}

/* Wishlist */
.ecomm-wishlist-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ecomm-wishlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 8px;
}

.ecomm-wishlist-name {
    color: var(--color-text, #1e293b);
}

.ecomm-wishlist-price {
    font-weight: 600;
    color: var(--color-danger, #dc2626);
}
