/**
 * Responsive Design & Animations
 */

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 640px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }

    .text-2xl { font-size: var(--text-lg); }
    .text-3xl { font-size: var(--text-xl); }
    .text-4xl { font-size: var(--text-2xl); }

    .container {
        padding: var(--space-md);
    }

    .card {
        padding: var(--space-md);
    }

    .modal-content {
        padding: var(--space-lg);
        max-width: 95%;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    .grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn var(--transition-base) ease-out;
}

/* Slide In Animation */
@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in-left {
    animation: slideInFromLeft var(--transition-base) ease-out;
}

/* Bounce Animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.bounce {
    animation: bounce 1s infinite;
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Spin Animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Shimmer/Skeleton Loading */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-200) 25%,
        var(--gray-100) 50%,
        var(--gray-200) 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    padding: var(--space-md) 0;
}

.nav-brand {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--primary);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--space-lg);
}

.nav-item a {
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

.nav-item a:hover {
    color: var(--primary);
}

.nav-item.active a {
    color: var(--primary);
    font-weight: var(--font-semibold);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        flex-direction: column;
        background-color: var(--bg-primary);
        border-top: 1px solid var(--border-color);
        padding: var(--space-lg);
        gap: var(--space-md);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }
}

/* ============================================
   FOOTER
   ============================================ */

footer {
    background-color: var(--gray-800);
    color: var(--gray-300);
    padding: var(--space-3xl) 0 var(--space-xl);
    margin-top: var(--space-3xl);
}

footer a {
    color: var(--gray-300);
}

footer a:hover {
    color: var(--primary);
}

.footer-section {
    margin-bottom: var(--space-2xl);
}

.footer-section h3 {
    color: white;
    margin-bottom: var(--space-lg);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

/* ============================================
   PRODUCT GRID
   ============================================ */

.product-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all var(--transition-base);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--bg-secondary);
}

.product-badge {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
}

.product-info {
    padding: var(--space-md);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-sm);
}

.product-description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    flex-grow: 1;
}

.product-price {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--primary);
    margin-bottom: var(--space-md);
}

.product-rating {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    font-size: var(--text-sm);
}

.star {
    color: var(--warning);
}

/* ============================================
   SHOPPING CART
   ============================================ */

.cart-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.cart-item-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.cart-item-info {
    flex: 1;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.quantity-input {
    width: 60px;
    padding: var(--space-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-align: center;
}

/* ============================================
   CHECKOUT FORM
   ============================================ */

.checkout-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.form-row.full {
    grid-template-columns: 1fr;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

[data-toast-container] {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    z-index: 1000;
    max-width: 400px;
}

.toast {
    margin-bottom: var(--space-md);
    animation: slideInFromLeft var(--transition-base) ease-out;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading {
    pointer-events: none;
    opacity: 0.6;
}

.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-md);
}

.empty-state-text {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

/* ============================================
   BREADCRUMBS
   ============================================ */

.breadcrumb {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    font-size: var(--text-sm);
}

.breadcrumb a {
    color: var(--primary);
}

.breadcrumb .active {
    color: var(--text-secondary);
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: var(--space-3xl) var(--space-md);
    text-align: center;
    margin-bottom: var(--space-3xl);
}

.hero h1 {
    color: white;
    margin-bottom: var(--space-lg);
}

.hero p {
    font-size: var(--text-lg);
    margin-bottom: var(--space-lg);
}

/* ============================================
   SECTION
   ============================================ */

section {
    padding: var(--space-3xl) 0;
}

section h2 {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}
