/**
 * Cartt Frontend Styles
 */

/* Product Grid */
.cartt-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    padding: 20px 0;
}

.cartt-product-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

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

.cartt-product-image {
    aspect-ratio: 1;
    background: #f5f5f5;
    overflow: hidden;
}

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

.cartt-product-info {
    padding: 16px;
}

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

.cartt-product-title a {
    color: inherit;
    text-decoration: none;
}

.cartt-product-title a:hover {
    color: #2271b1;
}

.cartt-product-price {
    font-size: 18px;
    font-weight: 700;
    color: #1d2327;
    margin-bottom: 12px;
}

.cartt-product-price .cartt-sale-price {
    color: #c00;
}

.cartt-product-price .cartt-original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 14px;
    margin-left: 8px;
}

/* Single Product */
.cartt-single-product {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 40px 0;
}

@media (max-width: 768px) {
    .cartt-single-product {
        grid-template-columns: 1fr;
    }
}

.cartt-product-gallery {
    background: #f5f5f5;
    border-radius: 8px;
    aspect-ratio: 1;
    overflow: hidden;
}

.cartt-product-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cartt-product-details h1 {
    font-size: 28px;
    margin: 0 0 16px;
}

.cartt-product-details .cartt-product-price {
    font-size: 24px;
    margin-bottom: 20px;
}

.cartt-product-description {
    color: #555;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Add to Cart Form */
.cartt-add-to-cart-form {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
}

.cartt-quantity-input {
    width: 80px;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.cartt-add-to-cart-btn {
    flex: 1;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: #2271b1;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.cartt-add-to-cart-btn:hover {
    background: #135e96;
}

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

/* Cart */
.cartt-cart {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.cartt-cart-empty {
    text-align: center;
    padding: 60px 20px;
}

.cartt-cart-empty h2 {
    margin-bottom: 10px;
}

.cartt-cart-empty p {
    color: #666;
    margin-bottom: 20px;
}

.cartt-cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.cartt-cart-table th,
.cartt-cart-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.cartt-cart-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
}

.cartt-cart-item-image {
    width: 60px;
    height: 60px;
    background: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
}

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

.cartt-cart-item-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.cartt-cart-item-remove {
    color: #c00;
    font-size: 12px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px 0;
}

.cartt-cart-item-remove:hover {
    text-decoration: underline;
}

.cartt-cart-totals {
    background: #f9f9f9;
    padding: 24px;
    border-radius: 8px;
}

.cartt-cart-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.cartt-cart-totals-row.total {
    font-size: 18px;
    font-weight: 700;
    border-top: 2px solid #ddd;
    margin-top: 12px;
    padding-top: 16px;
}

.cartt-cart-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
}

/* Checkout */
.cartt-checkout {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.cartt-checkout-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 40px;
}

@media (max-width: 900px) {
    .cartt-checkout-grid {
        grid-template-columns: 1fr;
    }
}

.cartt-checkout-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.cartt-checkout-section h2 {
    font-size: 18px;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.cartt-form-row {
    margin-bottom: 16px;
}

.cartt-form-row label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
}

.cartt-form-row input,
.cartt-form-row select {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.cartt-form-row input:focus,
.cartt-form-row select:focus {
    border-color: #2271b1;
    outline: none;
}

.cartt-form-row-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.cartt-order-summary {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 24px;
    position: sticky;
    top: 20px;
}

.cartt-order-summary h2 {
    font-size: 18px;
    margin: 0 0 20px;
}

.cartt-place-order-btn {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: #2271b1;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 20px;
}

.cartt-place-order-btn:hover {
    background: #135e96;
}

/* Buttons */
.cartt-btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cartt-btn-primary {
    color: #fff;
    background: #2271b1;
    border: none;
}

.cartt-btn-primary:hover {
    background: #135e96;
    color: #fff;
}

.cartt-btn-secondary {
    color: #1d2327;
    background: #f0f0f1;
    border: 1px solid #ddd;
}

.cartt-btn-secondary:hover {
    background: #e0e0e0;
    color: #1d2327;
}

/* Messages */
.cartt-message {
    padding: 16px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.cartt-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.cartt-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.cartt-message-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Loading */
.cartt-loading {
    text-align: center;
    padding: 40px;
}

.cartt-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f0f0f1;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: cartt-spin 0.8s linear infinite;
}

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

/* Currency Switcher */
.cartt-currency-selector {
    display: inline-block;
}

.cartt-currency-selector select {
    padding: 8px 32px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>') no-repeat right 10px center;
    background-size: 8px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    font-size: 14px;
}

.cartt-currency-selector select:hover {
    border-color: #999;
}

.cartt-currency-selector select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}
