/* Universal Styles */
:root {
    --primary-bg: #ffffff;
    --secondary-bg: #f8f8f8;
    --text-primary: #000000;
    --text-secondary: #4a4a4a;
    --border-color: #e5e5e5;
    --hover-bg: #f0f0f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Header Styles */
.header {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--primary-bg);
}

/* Make product grid super compact */
.products.grid {
    gap: 0.5rem !important;
}

/* Small product cards with smaller 1:1 images */
.product-card {
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: var(--primary-bg);
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Smaller 1:1 Image Container */
.product-image-container {
    position: relative;
    width: 100%;
    padding-bottom: 70%; /* Smaller image area - was 100% */
    overflow: hidden;
    background: var(--secondary-bg);
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Product Card Content */
.product-card-content {
    padding: 0.7rem; /* Slightly more padding for bigger buttons */
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.product-title {
    font-size: 0.85rem; /* Slightly bigger title */
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.2rem 0;
}

/* Compact platform tag */
.platform-tag {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    white-space: nowrap;
}

/* Share Button Styles */
.share-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem; /* Bigger share button */
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem; /* Bigger */
    height: 1.8rem; /* Bigger */
    color: var(--text-secondary);
}

.share-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
    transform: scale(1.1);
}

.share-btn .fas.fa-share-alt {
    font-size: 0.8rem; /* Bigger icon */
}

.product-description {
    font-size: 0.7rem;
    line-height: 1.3;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.4rem;
}

/* Bigger Price */
.product-price {
    font-size: 1rem; /* Much bigger price */
    font-weight: 700;
    color: var(--text-primary);
}

/* Bigger Buy Now Button */
.buy-now-btn {
    background-color: var(--text-primary);
    color: var(--primary-bg);
    padding: 0.5rem 1rem; /* Bigger padding */
    font-size: 0.85rem; /* Bigger text */
    font-weight: 600;
    border-radius: 6px; /* Slightly bigger radius */
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}

.buy-now-btn:hover {
    background-color: var(--text-secondary);
    transform: translateY(-1px);
}

/* Line clamp utilities */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Search Styles */
.search-container {
    position: relative;
}

.search-results {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:focus {
    background-color: var(--hover-bg);
    outline: none;
}

/* Search input focus state */
#searchInput:focus {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Product highlight animation */
.highlight-product {
    animation: highlightPulse 2s ease-in-out;
}

@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(0, 0, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
    }
}

/* Scrollbar styling for search results */
.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 4px 4px 0;
}

.search-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Enhanced Toast */
.share-toast {
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    background: var(--text-primary);
    color: var(--primary-bg);
    border: 1px solid var(--border-color);
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Mobile First Responsive Design */

/* Extra small devices (phones) */
@media (max-width: 475px) {
    .header {
        padding: 0.75rem 1rem;
    }
    
    .container {
        padding: 0 0.5rem;
    }
    
    #searchInput {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem 0.5rem 2rem;
    }
    
    .search-results {
        max-height: 50vh;
    }
    
    .search-result-item {
        padding: 0.75rem;
    }
    
    .search-result-item .flex.items-center.space-x-4 {
        gap: 0.75rem;
    }
    
    .search-result-item img {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    /* Mobile product card adjustments */
    .products.grid {
        gap: 0.4rem !important;
    }
    
    .product-card-content {
        padding: 0.6rem;
        gap: 0.3rem;
    }
    
    .product-title {
        font-size: 0.8rem;
    }
    
    .product-description {
        font-size: 0.65rem;
    }
    
    .product-price {
        font-size: 0.9rem; /* Still bigger on mobile */
    }
    
    .buy-now-btn {
        padding: 0.4rem 0.8rem; /* Bigger on mobile too */
        font-size: 0.75rem;
    }
    
    .platform-tag {
        font-size: 0.6rem;
        padding: 0.1rem 0.3rem;
    }
    
    .share-btn {
        width: 1.5rem; /* Bigger on mobile */
        height: 1.5rem; /* Bigger on mobile */
    }
    
    .share-btn .fas.fa-share-alt {
        font-size: 0.75rem; /* Bigger on mobile */
    }
}

/* Small devices (phones, 476px and up) */
@media (min-width: 476px) and (max-width: 767px) {
    .header {
        padding: 1rem 1.25rem;
    }
    
    #searchInput {
        font-size: 0.9rem;
    }
    
    .product-title {
        font-size: 0.82rem;
    }
    
    .product-price {
        font-size: 0.95rem;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .header {
        padding: 1rem 1.5rem;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    /* Show desktop layout */
    .header .flex-col {
        flex-direction: row;
    }
    
    .header .space-y-3 {
        gap: 0;
    }
    
    /* Show desktop login button */
    .header .hidden.md\:flex {
        display: flex !important;
    }
    
    /* Hide mobile login button */
    .header .md\:hidden {
        display: none !important;
    }
    
    .product-title {
        font-size: 0.9rem;
    }
    
    .product-price {
        font-size: 1.1rem; /* Even bigger on desktop */
    }
    
    .products.grid {
        gap: 0.6rem !important;
    }
}

/* Large devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
    .header {
        padding: 1rem 2rem;
    }
    
    .products.grid {
        gap: 0.75rem !important;
    }
    
    .product-title {
        font-size: 0.95rem;
    }
    
    .product-price {
        font-size: 1.2rem; /* Biggest on large screens */
    }
    
    .buy-now-btn {
        padding: 0.6rem 1.2rem; /* Biggest on large screens */
        font-size: 0.9rem;
    }
    
    .share-btn {
        width: 2rem; /* Biggest on large screens */
        height: 2rem; /* Biggest on large screens */
    }
    
    .share-btn .fas.fa-share-alt {
        font-size: 0.9rem; /* Biggest on large screens */
    }
}

/* Extra large devices (large desktops, 1280px and up) */
@media (min-width: 1280px) {
    .container {
        max-width: 1200px;
    }
}

/* Custom breakpoint for very small phones */
@media (max-width: 350px) {
    .header {
        padding: 0.5rem 0.75rem;
    }
    
    h1.text-xl {
        font-size: 1.125rem;
    }
    
    #searchInput {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem 0.4rem 1.75rem;
    }
    
    .fas.fa-search {
        left: 0.75rem;
        font-size: 0.8rem;
    }
    
    #clearSearch {
        right: 0.5rem;
    }
    
    /* Extra small product cards */
    .products.grid {
        gap: 0.3rem !important;
    }
    
    .product-card-content {
        padding: 0.5rem;
        gap: 0.25rem;
    }
    
    .product-title {
        font-size: 0.75rem;
    }
    
    .product-description {
        font-size: 0.6rem;
    }
    
    .product-price {
        font-size: 0.85rem; /* Still bigger than before */
    }
    
    .platform-tag {
        font-size: 0.55rem;
        padding: 0.08rem 0.25rem;
    }
    
    .buy-now-btn {
        padding: 0.35rem 0.7rem; /* Still bigger than before */
        font-size: 0.65rem;
    }
    
    .share-btn {
        width: 1.4rem; /* Still bigger than before */
        height: 1.4rem; /* Still bigger than before */
    }
}

/* Ensure search results are properly positioned on mobile */
@media (max-width: 767px) {
    .search-results {
        left: 0;
        right: 0;
        width: 100vw;
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* Fix for very small screen heights */
@media (max-height: 600px) {
    .search-results {
        max-height: 40vh;
    }
}

/* About page specific styles */
.about-section {
    background: linear-gradient(135deg, #f8f8f8 0%, #ffffff 100%);
}

.value-card {
    transition: all 0.3s ease;
}

.value-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.process-step {
    transition: all 0.3s ease;
}

.process-step:hover {
    transform: scale(1.05);
}

/* Auth page styles */
.auth-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f8f8 0%, #ffffff 100%);
}

.auth-card {
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.input-field {
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.input-field:focus {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Admin dashboard styles */
.admin-header {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--primary-bg);
}

.admin-card {
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.admin-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Loading states */
.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Focus states for accessibility */
button:focus,
a:focus,
input:focus {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

/* Selection styles */
::selection {
    background-color: var(--text-primary);
    color: var(--primary-bg);
}

::-moz-selection {
    background-color: var(--text-primary);
    color: var(--primary-bg);
}