/**
 * LitAmb Stack (Cart) Styles
 *
 * Floating stack icon and panel styles.
 *
 * @package LitAmbPro
 */

/* ==========================================================================
   Floating Stack Container
   ========================================================================== */

.litamb-floating-stack {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==========================================================================
   Stack Toggle Button
   ========================================================================== */

.litamb-stack-toggle {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--litamb-primary, #3b82f6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.litamb-stack-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(59, 130, 246, 0.5);
}

.litamb-stack-toggle:active {
    transform: scale(0.95);
}

.litamb-stack-icon {
    width: 24px;
    height: 24px;
    color: #fff;
}

/* Count Badge */
.litamb-stack-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 22px;
    text-align: center;
    border-radius: 11px;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.litamb-stack-count.has-items {
    opacity: 1;
    transform: scale(1);
}

/* Pulse Animation */
.litamb-stack-toggle.litamb-pulse {
    animation: litamb-pulse 0.6s ease;
}

@keyframes litamb-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   Stack Panel
   ========================================================================== */

.litamb-stack-panel {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 380px;
    max-height: calc(100vh - 150px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.litamb-floating-stack.is-open .litamb-stack-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Panel Header */
.litamb-stack-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.litamb-stack-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.litamb-stack-close {
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.litamb-stack-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.litamb-stack-close svg {
    width: 18px;
    height: 18px;
}

/* Panel Body */
.litamb-stack-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    max-height: 400px;
}

/* Empty State */
.litamb-stack-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}

.litamb-stack-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.litamb-stack-empty p {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 500;
    color: #6b7280;
}

.litamb-stack-empty span {
    font-size: 13px;
}

/* Stack Items */
.litamb-stack-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.litamb-stack-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 12px;
    transition: background-color 0.2s ease, opacity 0.3s ease;
}

.litamb-stack-item.litamb-removing {
    opacity: 0.5;
    pointer-events: none;
}

.litamb-stack-item.litamb-unavailable {
    opacity: 0.6;
    background: #fef2f2;
}

/* Item Image */
.litamb-stack-item-image {
    flex-shrink: 0;
    width: 50px;
    height: 65px;
    border-radius: 6px;
    overflow: hidden;
    background: #e5e7eb;
}

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

.litamb-stack-item-image .litamb-no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.litamb-stack-item-image .litamb-no-thumb svg {
    width: 24px;
    height: 24px;
}

/* Item Details */
.litamb-stack-item-details {
    flex: 1;
    min-width: 0;
}

.litamb-stack-item-title {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

.litamb-stack-item-title a {
    color: #1f2937;
    text-decoration: none;
}

.litamb-stack-item-title a:hover {
    color: var(--litamb-primary, #3b82f6);
}

.litamb-stack-item-author {
    margin: 0 0 6px;
    font-size: 12px;
    color: #6b7280;
}

.litamb-stack-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.litamb-stack-item-type {
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    background: #e5e7eb;
    padding: 2px 8px;
    border-radius: 4px;
}

.litamb-stack-item-points {
    font-size: 12px;
    font-weight: 600;
    color: var(--litamb-primary, #3b82f6);
}

.litamb-unavailable-badge {
    font-size: 11px;
    font-weight: 500;
    color: #dc2626;
    background: #fee2e2;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Remove Button */
.litamb-stack-item-remove {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.litamb-stack-item-remove:hover {
    background: #fee2e2;
    color: #dc2626;
}

.litamb-stack-item-remove svg {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Panel Footer
   ========================================================================== */

.litamb-stack-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.litamb-stack-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.litamb-stack-total {
    display: flex;
    align-items: center;
    gap: 8px;
}

.litamb-stack-total span {
    font-size: 14px;
    color: #6b7280;
}

.litamb-stack-points {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

.litamb-stack-limit {
    font-size: 13px;
    color: #6b7280;
}

.litamb-stack-actions {
    display: flex;
    gap: 8px;
}

.litamb-stack-actions .litamb-btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.litamb-stack-actions .litamb-btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.litamb-stack-actions .litamb-btn-secondary:hover {
    background: #d1d5db;
}

.litamb-stack-actions .litamb-btn-primary {
    background: var(--litamb-primary, #3b82f6);
    color: #fff;
}

.litamb-stack-actions .litamb-btn-primary:hover {
    background: var(--litamb-primary-hover, #2563eb);
}

.litamb-stack-actions .litamb-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   Add to Stack Button
   ========================================================================== */

.litamb-add-to-stack {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--litamb-primary, #3b82f6);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.litamb-add-to-stack:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.litamb-add-to-stack.litamb-in-stack {
    color: #059669;
    background: rgba(5, 150, 105, 0.1);
    border-color: rgba(5, 150, 105, 0.2);
    cursor: default;
}

.litamb-add-to-stack svg {
    flex-shrink: 0;
}

/* ==========================================================================
   Notification Toast
   ========================================================================== */

.litamb-notification {
    position: fixed;
    bottom: 100px;
    right: 24px;
    padding: 14px 20px;
    background: #1f2937;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10000;
}

.litamb-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.litamb-notification-success {
    background: #059669;
}

.litamb-notification-error {
    background: #dc2626;
}

/* ==========================================================================
   Spinner
   ========================================================================== */

.litamb-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: litamb-spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 480px) {
    .litamb-floating-stack {
        bottom: 16px;
        right: 16px;
    }

    .litamb-stack-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 80vh;
        border-radius: 20px 20px 0 0;
    }

    .litamb-floating-stack.is-open .litamb-stack-toggle {
        opacity: 0;
        pointer-events: none;
    }

    .litamb-notification {
        left: 16px;
        right: 16px;
        bottom: 80px;
    }
}
