/* Global Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-main);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--text-main);
    margin-top: 0;
    font-weight: 700;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-base);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    display: block;
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.main-content {
    padding: var(--spacing-lg) 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition-base);
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-light);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Inputs */
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    transition: var(--transition-base);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-new {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.badge-hot {
    background-color: #fff7ed;
    color: var(--accent-color);
}


/* --- Grid Systems --- */
.grid-phones {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.grid-brands {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

/* --- Cards --- */
.card-phone {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: var(--transition-base);
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-phone:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-phone-img-wrapper {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.card-phone-img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
}

.card-phone-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--text-main);
    line-height: 1.3;
}

.card-phone-price {
    margin-top: auto;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.1rem;
}

.card-phone-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Brand Chips --- */
.brand-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-weight: 600;
    transition: var(--transition-base);
    min-width: 100px;
}

.brand-chip:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* --- Homepage Hero --- */
.home-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    padding: var(--spacing-xl) var(--spacing-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-xl);
    text-align: center;
}

.home-hero h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: var(--spacing-md);
}

.home-hero .search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

/* --- Store Cards --- */
.grid-stores {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.card-store {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    transition: var(--transition-base);
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.card-store:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-store-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    margin-bottom: var(--spacing-md);
}

.card-store-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    color: var(--text-main);
}

.card-store-action {
    margin-top: auto;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
    background: #f2f2f2 !important;
    /* Distinct light gray */
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: var(--spacing-lg);
    font-size: 0.9rem;
    color: var(--text-muted);
    border: 1px solid #e0e0e0;
    /* Subtle border */
    box-shadow: none;
}

.breadcrumbs ol {
    list-style: none !important;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.breadcrumbs li {
    display: inline-flex;
    align-items: center;
}

.breadcrumbs li:not(:last-child)::after {
    content: "/";
    margin: 0 8px;
    font-size: 0.8em;
    color: #ccc;
    font-weight: 400;
}

.breadcrumbs a {
    color: #0056b3;
    /* Darker blue usually looks better */
    font-weight: 500;
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.breadcrumbs .current {
    color: #666;
    font-weight: 400;
}

/* --- Mobile Specific Overrides --- */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
        /* Reduced side margins */
    }

    .grid-phones {
        grid-template-columns: repeat(2, 1fr);
        /* Force 2 columns */
        gap: 10px;
        /* Tighter gap */
        margin-bottom: 20px;
    }

    .card-phone {
        padding: 10px;
        /* Reduced internal padding */
    }

    .card-phone-img-wrapper {
        height: 120px;
        /* Smaller image area */
        margin-bottom: 10px;
        padding: 5px;
    }

    .card-phone-title {
        font-size: 0.9rem;
        /* Slightly smaller text */
        height: 2.4em;
        /* Limit height to 2 lines approx */
        overflow: hidden;
    }

    .card-phone-price {
        font-size: 1rem;
    }

    .card-phone-meta {
        font-size: 0.75rem;
    }

    /* Brands Grid on Phones */
    .grid-brands-visual {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .card-brand {
        padding: 15px !important;
    }

    /* Stores Grid on Phones */
    .grid-stores {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .card-store {
        padding: 15px;
    }

    .card-store-logo {
        height: 40px;
    }
}