/* Common styles for consistent UI elements across the application */

/* Container styles */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md);
    box-shadow: var(--box-shadow-md);
    background-color: white;
    animation: fadeIn 0.8s ease-out;
}

/* Card styles moved to base.css */

/* Button styles moved to base.css */

/* Table styles */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background-color: var(--primary-color);
    color: white;
}

.table th,
.table td {
    padding: var(--spacing-md);
    text-align: left;
}

.table th {
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
}

.table tbody tr:nth-child(even) {
    background-color: var(--background-light);
}

.table tbody tr:hover {
    background-color: #e9ecef;
    transition: background-color 0.3s ease;
}

/* Form input styles */
.form-input {
    width: 100%;
    padding: var(--spacing-md);
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: #f8f9fa;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
    background: white;
}

/* Alert styles moved to base.css */

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Cart Sidebar Styles */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 350px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 10001;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.cart-sidebar-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.cart-sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s;
}

.cart-sidebar-close:hover {
    background: #e9ecef;
    color: #333;
}

.cart-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
}

.cart-sidebar-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.cart-sidebar-empty i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
}

.cart-sidebar-empty p {
    margin-bottom: 20px;
}

.btn-continuar-comprando {
    background: #007bff;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: background 0.3s;
}

.btn-continuar-comprando:hover {
    background: #0056b3;
}

/* Cart Sidebar Items */
.cart-sidebar-items {
    padding: 0 20px;
}

.cart-sidebar-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.cart-sidebar-item:last-child {
    border-bottom: none;
}

.cart-sidebar-item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 15px;
    flex-shrink: 0;
}

.cart-sidebar-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-sidebar-item-details {
    flex: 1;
}

.cart-sidebar-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    display: block;
    text-decoration: none;
}

.cart-sidebar-item-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.cart-sidebar-quantity-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-btn {
    width: 25px;
    height: 25px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    color: #333;
    transition: all 0.2s;
}

.quantity-btn:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.quantity {
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.cart-sidebar-item-price {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.precio-container {
    display: flex;
    align-items: flex-end;
    text-align: right;
}

.precio-anterior {
    text-decoration: line-through;
    color: #6c757d;
    font-weight: normal;
    font-size: 0.9rem;
    margin: 0 0 2px 0;
}

.precio-actual {
    color: #28a745;
    font-weight: 700;
    font-size: 0.9rem;
    margin: 0;
}

.original-price {
    text-decoration: line-through;
    color: #6c757d;
    font-weight: normal;
    font-size: 0.8rem;
    margin-right: 5px;
}

.discount-price {
    color: #28a745;
}

/* Cart Sidebar Summary */
.cart-sidebar-summary {
    border-top: 1px solid #eee;
    padding: 20px;
}

.cart-sidebar-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 0.9rem;
}

.cart-sidebar-summary-row.shipping-row {
    cursor: pointer;
    transition: background 0.2s;
    padding: 12px 0;
    border-radius: 4px;
}

.cart-sidebar-summary-row.shipping-row:hover {
    background: #f8f9fa;
}

.shipping-arrow {
    transition: transform 0.3s ease;
}

.shipping-arrow.fa-chevron-up {
    transform: rotate(180deg);
}

.cart-sidebar-shipping-arrow {
    transition: transform 0.3s ease;
}

.cart-sidebar-shipping-arrow.rotated {
    transform: rotate(90deg);
}

.cart-sidebar-shipping-options {
    margin-top: 15px;
    visibility: hidden;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.cart-sidebar-shipping-options.expanded {
    visibility: visible;
    opacity: 1;
    max-height: 500px;
}

.cart-sidebar-shipping-option {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.cart-sidebar-shipping-option:hover {
    border-color: #007bff;
    background: #f0f8ff;
}

.cart-sidebar-shipping-option.selected {
    border-color: #007bff;
    background: #e7f3ff;
}

.cart-sidebar-shipping-option input[type="radio"] {
    display: none;
}

.radio-indicator {
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s;
}

.cart-sidebar-shipping-option.selected .radio-indicator {
    border-color: #007bff;
    background: white;
}

.cart-sidebar-shipping-option.selected .radio-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #007bff;
    border-radius: 50%;
}

.shipping-icon {
    margin-right: 10px;
    font-size: 1rem;
    color: #007bff;
    min-width: 20px;
    text-align: center;
}

.shipping-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shipping-name {
    font-weight: 600;
    color: #333;
    font-size: 0.85rem;
}

.shipping-price {
    font-weight: 600;
    color: #007bff;
    font-size: 0.85rem;
}

.cart-sidebar-summary-row.total {
    border-top: 2px solid #007bff;
    margin-top: 10px;
    padding-top: 15px;
    font-size: 1rem;
    font-weight: 700;
    color: #333;
}

/* Cart Sidebar Actions */
.cart-sidebar-actions {
    position: sticky;
    bottom: 0;
    border-top: 1px solid #eee;
    padding: 20px;
    background: #f8f9fa;
}

.btn-ver-carrito,
.btn-checkout {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.btn-ver-carrito {
    background: #6c757d;
    color: white;
}

.btn-ver-carrito:hover {
    background: #5a6268;
}

.btn-checkout {
    background: #007bff;
    color: white;
}

.btn-checkout:hover {
    background: #0056b3;
}

/* Shipping info message */
.shipping-info-message {
    background: #fff3cd;
    color: #856404;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.shipping-info-message i {
    font-size: 0.9rem;
}

/* Loading shipping */
.loading-shipping {
    text-align: center;
    text-decoration: none;
}

.loading-shipping i {
    font-size: 2rem;
    margin-bottom: 10px;
    text-decoration: none;
}

/* Cart sidebar loading */
.cart-sidebar-loading {
    text-align: center;
    text-decoration: none;
}

.cart-sidebar-loading i {
    font-size: 2rem;
    color: #007bff;
    margin-bottom: 10px;
    text-decoration: none;
}

.cart-sidebar-loading p {
    margin: 0;
    color: #007bff;
    text-decoration: none;
}

/* Overlay */
.cart-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.cart-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: var(--spacing-lg);
    }

    .cart-sidebar {
        width: 320px;
        right: -320px;
    }

    .table thead {
        display: none;
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
    }

    .table tr {
        margin-bottom: var(--spacing-md);
        background-color: white;
        animation: fadeIn 0.5s ease-out backwards;
    }

    .table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
    }

    .table td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        text-align: left;
        font-weight: 600;
    }

    .btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: var(--spacing-md);
    }
}
