/**
 * GutsyBites Invoicing Frontend Styles
 * Placeholder - will be expanded in Phase 2
 */

/* Cart icon */
.gb-cart-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.gb-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #004243;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Product card */
.gb-product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.gb-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gb-product-image {
    aspect-ratio: 16/10;
    overflow: hidden;
}

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

.gb-product-content {
    padding: 1.25rem;
}

.gb-product-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.gb-product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #004243;
}

/* Shopping cart */
.gb-shopping-cart {
    max-width: 600px;
    margin: 0 auto;
}

.gb-cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

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

.gb-cart-item-details {
    flex: 1;
}

.gb-cart-item-name {
    font-weight: 600;
}

.gb-cart-item-variation {
    font-size: 0.875rem;
    color: #666;
}

.gb-cart-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gb-cart-quantity button {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.gb-cart-quantity button:hover {
    background: #f5f5f5;
}

.gb-cart-totals {
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 8px;
    margin-top: 1rem;
}

.gb-cart-total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.gb-cart-total-row.total {
    font-size: 1.25rem;
    font-weight: 700;
    border-top: 2px solid #ddd;
    padding-top: 1rem;
    margin-top: 0.5rem;
}

/* Checkout form */
.gb-checkout-form {
    max-width: 600px;
    margin: 0 auto;
}

.gb-checkout-step {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.gb-checkout-step h2 {
    margin-top: 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.gb-form-field {
    margin-bottom: 1rem;
}

.gb-form-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.gb-form-field input,
.gb-form-field select,
.gb-form-field textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.gb-form-field input:focus,
.gb-form-field select:focus,
.gb-form-field textarea:focus {
    outline: none;
    border-color: #004243;
    box-shadow: 0 0 0 2px rgba(0, 66, 67, 0.1);
}

.gb-form-row {
    display: flex;
    gap: 1rem;
}

.gb-form-row .gb-form-field {
    flex: 1;
}

/* Buttons */
.gb-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s;
}

.gb-button--primary {
    background: #56c878;
    color: #fff;
    box-shadow: 0 4px 14px rgba(86, 200, 120, 0.3);
}

.gb-button--primary:hover {
    background: #3da85e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(86, 200, 120, 0.4);
}

.gb-button--secondary {
    background: #f5f5f5;
    color: #333;
}

.gb-button--secondary:hover {
    background: #eee;
}

.gb-button--full {
    width: 100%;
}

/* Loading state */
.gb-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Welcome back message */
.gb-welcome-back {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Error message */
.gb-error {
    background: #ffebee;
    color: #c62828;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* Empty cart */
.gb-empty-cart {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.gb-empty-cart svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ============================================
   FLOATING MINI-CART
   Matches program page design system
   ============================================ */

/* Design variables matching program page */
.gb-floating-cart {
    --gb-accent: #56c878;
    --gb-accent-dark: #3da85e;
    --gb-accent-light: rgba(86, 200, 120, 0.1);
    --gb-text: #1a1a2e;
    --gb-text-muted: #64748b;
    --gb-bg: #ffffff;
    --gb-bg-alt: #f8fafc;
    --gb-border: #e2e8f0;
    --gb-radius: 16px;
    --gb-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animation keyframes */
@keyframes gb-cart-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes gb-cart-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes gb-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Container - hidden by default, only visible with items */
.gb-floating-cart {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99990;
    display: none;
}

.gb-floating-cart--has-items {
    display: block;
}

/* Floating button - matches program page button style */
.gb-floating-cart-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gb-accent) 0%, var(--gb-accent-dark) 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 20px rgba(86, 200, 120, 0.4),
        0 0 0 0 rgba(86, 200, 120, 0.4);
    transition: all var(--gb-transition);
    position: relative;
    animation: gb-cart-bounce 0.5s ease-out;
}

.gb-floating-cart-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow:
        0 8px 30px rgba(86, 200, 120, 0.5),
        0 0 0 4px rgba(86, 200, 120, 0.15);
}

.gb-floating-cart-btn:active {
    transform: translateY(-1px) scale(1.02);
}

.gb-floating-cart-btn svg {
    width: 28px;
    height: 28px;
    stroke-width: 2.5;
}

/* Count badge */
.gb-floating-cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--gb-text);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    border: 2px solid #fff;
}

/* Backdrop */
.gb-mini-cart-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 46, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99991;
    animation: gb-fade-in 0.3s ease-out;
}

.gb-floating-cart--open .gb-mini-cart-backdrop {
    display: block;
}

/* Panel - slide-out drawer */
.gb-mini-cart-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 92vw;
    background: var(--gb-bg);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 99992;
    border-radius: var(--gb-radius) 0 0 var(--gb-radius);
}

.gb-floating-cart--open .gb-mini-cart-panel {
    transform: translateX(0);
}

/* Header */
.gb-mini-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gb-border);
}

.gb-mini-cart-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gb-text);
    letter-spacing: -0.01em;
}

.gb-mini-cart-close {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--gb-bg-alt);
    color: var(--gb-text-muted);
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--gb-transition);
}

.gb-mini-cart-close:hover {
    background: var(--gb-accent-light);
    color: var(--gb-accent-dark);
    transform: rotate(90deg);
}

/* Content area */
.gb-mini-cart-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

/* Cart items */
.gb-mini-cart-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gb-mini-cart-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--gb-bg-alt);
    border-radius: var(--gb-radius);
    transition: all var(--gb-transition);
    position: relative;
}

.gb-mini-cart-item:hover {
    background: var(--gb-accent-light);
}

.gb-mini-cart-item-info {
    width: 100%;
    padding-right: 2rem; /* Space for remove button */
}

.gb-mini-cart-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Quantity controls */
.gb-mini-cart-item-qty-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.5rem;
}

.gb-qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--gb-border);
    background: var(--gb-bg);
    color: var(--gb-text);
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--gb-transition);
    padding: 0;
    line-height: 1;
}

.gb-qty-btn:hover {
    background: var(--gb-accent-light);
    border-color: var(--gb-accent);
    color: var(--gb-accent-dark);
}

.gb-mini-cart-item-qty-controls .gb-mini-cart-item-qty {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    background: transparent;
    margin: 0;
    padding: 0;
}

.gb-mini-cart-item-name {
    display: block;
    font-weight: 600;
    color: var(--gb-text);
    font-size: 0.95rem;
    line-height: 1.4;
}

.gb-mini-cart-item-variation {
    display: block;
    font-size: 0.8rem;
    color: var(--gb-text-muted);
    margin-top: 0.125rem;
}

.gb-mini-cart-item-qty {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--gb-text-muted);
    background: var(--gb-bg);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.25rem;
}

.gb-mini-cart-item-price {
    font-weight: 700;
    color: var(--gb-accent-dark);
    font-size: 1rem;
    white-space: nowrap;
}

.gb-mini-cart-item-remove {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--gb-text-muted);
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--gb-transition);
    opacity: 0.6;
}

.gb-mini-cart-item:hover .gb-mini-cart-item-remove {
    opacity: 1;
}

.gb-mini-cart-item-remove:hover {
    color: #dc3545;
    background: #fee2e2;
    opacity: 1;
}

/* Footer */
.gb-mini-cart-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--gb-border);
    background: var(--gb-bg-alt);
    border-radius: 0 0 0 var(--gb-radius);
}

.gb-mini-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    font-size: 1rem;
}

.gb-mini-cart-total span {
    color: var(--gb-text-muted);
    font-weight: 500;
}

.gb-mini-cart-total strong {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gb-text);
}

/* Checkout button - matches program page primary button */
.gb-mini-cart-checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--gb-accent) 0%, var(--gb-accent-dark) 100%);
    color: #fff !important;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none !important;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(86, 200, 120, 0.35);
    transition: all var(--gb-transition);
}

.gb-mini-cart-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(86, 200, 120, 0.45);
}

.gb-mini-cart-checkout::after {
    content: '→';
    font-size: 1.1rem;
    transition: transform var(--gb-transition);
}

.gb-mini-cart-checkout:hover::after {
    transform: translateX(4px);
}

/* Empty state */
.gb-mini-cart-empty {
    flex: 1;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--gb-text-muted);
}

.gb-mini-cart-empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.3;
    stroke: var(--gb-text-muted);
}

.gb-mini-cart-empty p {
    margin: 0;
    font-size: 1rem;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .gb-floating-cart {
        bottom: 20px;
        right: 20px;
    }

    .gb-floating-cart-btn {
        width: 56px;
        height: 56px;
    }

    .gb-floating-cart-btn svg {
        width: 24px;
        height: 24px;
    }

    .gb-mini-cart-panel {
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
    }

    .gb-mini-cart-footer {
        border-radius: 0;
    }
}
