/**
 * Cart Styles
 *
 * Styles for the shopping cart mini-cart and cart page.
 *
 * @package GMCosta
 * @subpackage Domains\OMS\Web
 * @since 2.0.0
 */

/* ==========================================================================
   Mini Cart (Header Widget)
   ========================================================================== */

.gmcosta-mini-cart {
    position: relative;
}

.gmcosta-mini-cart-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: inherit;
    transition: opacity 0.2s ease;
}

.gmcosta-mini-cart-toggle:hover {
    opacity: 0.8;
}

.gmcosta-mini-cart-icon {
    position: relative;
    width: 24px;
    height: 24px;
}

.gmcosta-mini-cart-icon svg {
    width: 100%;
    height: 100%;
}

.gmcosta-mini-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--gmcosta-primary, #e53935);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
}

.gmcosta-mini-cart-count:empty,
.gmcosta-mini-cart-count[data-count="0"] {
    display: none;
}

/* Mini Cart Dropdown */
.gmcosta-mini-cart-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    max-height: 400px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

.gmcosta-mini-cart.is-open .gmcosta-mini-cart-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.gmcosta-mini-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.gmcosta-mini-cart-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.gmcosta-mini-cart-items {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.gmcosta-mini-cart-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.gmcosta-mini-cart-item-image {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

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

.gmcosta-mini-cart-item-details {
    flex: 1;
    min-width: 0;
}

.gmcosta-mini-cart-item-name {
    font-weight: 500;
    font-size: 0.875rem;
    margin: 0 0 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gmcosta-mini-cart-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #666;
}

.gmcosta-mini-cart-item-price {
    font-weight: 600;
    color: var(--gmcosta-primary, #333);
}

.gmcosta-mini-cart-item-remove {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.gmcosta-mini-cart-item-remove:hover {
    color: #e53935;
}

.gmcosta-mini-cart-footer {
    padding: 1rem;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.gmcosta-mini-cart-subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-weight: 600;
}

.gmcosta-mini-cart-actions {
    display: flex;
    gap: 0.5rem;
}

.gmcosta-mini-cart-actions .btn {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    text-align: center;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
}

.gmcosta-mini-cart-actions .btn-outline {
    background: transparent;
    border: 1px solid #333;
    color: #333;
}

.gmcosta-mini-cart-actions .btn-outline:hover {
    background: #333;
    color: #fff;
}

.gmcosta-mini-cart-actions .btn-primary {
    background: var(--gmcosta-primary, #e53935);
    border: 1px solid var(--gmcosta-primary, #e53935);
    color: #fff;
}

.gmcosta-mini-cart-actions .btn-primary:hover {
    opacity: 0.9;
}

.gmcosta-mini-cart-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #666;
}

/* ==========================================================================
   Cart Page
   ========================================================================== */

.gmcosta-cart-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.gmcosta-cart-page h1 {
    margin-bottom: 2rem;
}

.gmcosta-cart-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}

@media (max-width: 768px) {
    .gmcosta-cart-container {
        grid-template-columns: 1fr;
    }
}

/* Cart Items Table */
.gmcosta-cart-items {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.gmcosta-cart-items-header {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr 1fr auto;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #f5f5f5;
    font-weight: 600;
    font-size: 0.875rem;
    color: #666;
}

@media (max-width: 768px) {
    .gmcosta-cart-items-header {
        display: none;
    }
}

.gmcosta-cart-item {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

@media (max-width: 768px) {
    .gmcosta-cart-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

.gmcosta-cart-item:last-child {
    border-bottom: none;
}

.gmcosta-cart-item-product {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gmcosta-cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

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

.gmcosta-cart-item-info h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 600;
}

.gmcosta-cart-item-info p {
    margin: 0;
    font-size: 0.875rem;
    color: #666;
}

.gmcosta-cart-item-price {
    font-weight: 500;
}

@media (max-width: 768px) {
    .gmcosta-cart-item-price::before {
        content: "Price: ";
        color: #666;
    }
}

/* Quantity Control */
.gmcosta-quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    width: fit-content;
}

.gmcosta-quantity-control button {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.gmcosta-quantity-control button:hover {
    background: #eee;
}

.gmcosta-quantity-control button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gmcosta-quantity-control input {
    width: 50px;
    height: 32px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 0.875rem;
    -moz-appearance: textfield;
}

.gmcosta-quantity-control input::-webkit-outer-spin-button,
.gmcosta-quantity-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.gmcosta-cart-item-total {
    font-weight: 600;
    color: var(--gmcosta-primary, #333);
}

@media (max-width: 768px) {
    .gmcosta-cart-item-total::before {
        content: "Total: ";
        color: #666;
        font-weight: 400;
    }
}

.gmcosta-cart-item-remove {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.gmcosta-cart-item-remove:hover {
    color: #e53935;
}

/* Cart Summary */
.gmcosta-cart-summary {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.gmcosta-cart-summary h2 {
    margin: 0 0 1.5rem;
    font-size: 1.25rem;
}

.gmcosta-cart-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.gmcosta-cart-summary-row:last-of-type {
    border-bottom: none;
}

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

.gmcosta-cart-summary .btn-checkout {
    display: block;
    width: 100%;
    padding: 1rem;
    margin-top: 1.5rem;
    background: var(--gmcosta-primary, #e53935);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: opacity 0.2s;
}

.gmcosta-cart-summary .btn-checkout:hover {
    opacity: 0.9;
}

.gmcosta-cart-summary .btn-checkout:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.gmcosta-continue-shopping {
    display: block;
    text-align: center;
    margin-top: 1rem;
    color: #666;
    text-decoration: none;
}

.gmcosta-continue-shopping:hover {
    text-decoration: underline;
}

/* Empty Cart */
.gmcosta-cart-empty {
    text-align: center;
    padding: 4rem 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.gmcosta-cart-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    opacity: 0.3;
}

.gmcosta-cart-empty h2 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
}

.gmcosta-cart-empty p {
    margin: 0 0 1.5rem;
    color: #666;
}

.gmcosta-cart-empty .btn-primary {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: var(--gmcosta-primary, #e53935);
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.gmcosta-cart-empty .btn-primary:hover {
    opacity: 0.9;
}

/* ==========================================================================
   Add to Cart Button
   ========================================================================== */

.gmcosta-add-to-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--gmcosta-primary, #e53935);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.gmcosta-add-to-cart:hover {
    opacity: 0.9;
}

.gmcosta-add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.gmcosta-add-to-cart.is-loading {
    pointer-events: none;
}

.gmcosta-add-to-cart .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.gmcosta-add-to-cart.is-added {
    background: #4caf50;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.gmcosta-toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gmcosta-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: #333;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    opacity: 0;
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.gmcosta-toast.is-exiting {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.gmcosta-toast.success {
    background: #4caf50;
}

.gmcosta-toast.error {
    background: #e53935;
}

.gmcosta-toast-message {
    flex: 1;
}

.gmcosta-toast-action {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 0.5rem 1rem;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: none;
}

.gmcosta-toast-action:hover {
    background: rgba(255, 255, 255, 0.3);
}
