/* =============================================================================
   Kyamz Electronic Shop - Front-end Stylesheet
   Responsive: mobile-first, breakpoints at 768px and 1024px
   ============================================================================= */

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* --- Root variables --- */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --dark: #0f172a;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
    --container: 1200px;
}

/* --- Base --- */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; display: block; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }

/* --- Header / Navbar --- */
.site-header {
    background: var(--dark);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    gap: 20px;
}
.logo {
    font-size: 20px;
    font-weight: 800;
    color: var(--white);
    white-space: nowrap;
}
.logo span { color: var(--primary); }
.nav-links {
    display: flex;
    gap: 24px;
    list-style: none;
}
.nav-links a {
    color: #cbd5e1;
    font-size: 15px;
    font-weight: 500;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: color .2s, border-color .2s;
}
.nav-links a:hover, .nav-links a.active {
    color: var(--white);
    border-bottom-color: var(--primary);
}
.nav-search {
    display: flex;
    gap: 0;
    flex: 1;
    max-width: 320px;
}
.nav-search input {
    flex: 1;
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 14px;
}
.nav-search button {
    padding: 8px 16px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
    font-size: 14px;
}
.nav-search button:hover { background: var(--primary-dark); }
.nav-admin {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
}
.nav-admin a { color: #94a3b8; }
.nav-admin a:hover { color: var(--white); }

/* --- Mobile nav --- */
.nav-toggle { display: none; background: none; border: none; color: var(--white); font-size: 24px; cursor: pointer; }

/* --- Hero --- */
.hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #2563eb 100%);
    color: var(--white);
    padding: 64px 0;
    text-align: center;
}
.hero h1 { font-size: 32px; margin-bottom: 12px; }
.hero p { font-size: 18px; color: #cbd5e1; margin-bottom: 28px; max-width: 600px; margin-left: auto; margin-right: auto; }
.hero .btn { font-size: 16px; padding: 12px 32px; }

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s, transform .1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); color: var(--white); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-lg { padding: 14px 32px; font-size: 16px; }

/* --- Section headings --- */
.section { padding: 48px 0; }
.section-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
}
.section-subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 16px;
}

/* --- Product grid --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}
.product-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.product-card .product-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f1f5f9;
}
.product-card .product-img-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #94a3b8;
}
.product-card .product-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.product-card .category-badge {
    font-size: 11px;
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.product-card h3 {
    font-size: 16px;
    margin-bottom: 6px;
}
.product-card h3 a { color: var(--text); }
.product-card h3 a:hover { color: var(--primary); }
.product-card .price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}
.product-card .currency { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.product-card .stock {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.product-card .stock .in-stock { color: var(--success); font-weight: 600; }
.product-card .stock .out-stock { color: var(--danger); font-weight: 600; }
.product-card .btn { margin-top: auto; }

/* --- Category cards --- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}
.category-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    border: 2px solid transparent;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text);
}
.category-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    color: var(--text);
}
.cat-thumb {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    background: #f1f5f9;
}
.cat-thumb-placeholder {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
}
.category-card h3 {
    font-size: 15px;
    margin: 10px 12px 4px;
    font-weight: 700;
}
.category-card .count {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* --- Breadcrumb --- */
.breadcrumb {
    padding: 16px 0;
    font-size: 14px;
    color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 8px; }

/* --- Shop filters --- */
.shop-layout { display: grid; grid-template-columns: 240px 1fr; gap: 32px; align-items: start; }
.shop-sidebar {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 80px;
}
.shop-sidebar h3 { font-size: 16px; margin-bottom: 12px; }
.filter-list { list-style: none; }
.filter-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.filter-list li:last-child { border-bottom: none; }
.filter-list a {
    display: flex;
    justify-content: space-between;
    color: var(--text);
    font-size: 14px;
}
.filter-list a:hover { color: var(--primary); }
.filter-list .active { font-weight: 700; color: var(--primary); }
.filter-list .badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
}
.shop-results-info { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }

/* --- Product detail --- */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}
.product-detail .product-image {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
}
.product-detail .product-image img,
.product-detail .product-image .placeholder {
    width: 100%;
    height: 400px;
    object-fit: cover;
}
.product-detail .product-image .placeholder {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    color: #94a3b8;
}
.product-detail .info h1 { font-size: 26px; margin-bottom: 8px; }
.product-detail .info .price { font-size: 32px; font-weight: 800; color: var(--primary); margin: 12px 0; }
.product-detail .info .meta { margin-bottom: 20px; }
.product-detail .info .description { margin-bottom: 24px; color: var(--text); }
.product-detail .info .specs { margin-bottom: 24px; }
.product-detail .info .specs dt { font-weight: 600; color: var(--text-muted); font-size: 14px; }
.product-detail .info .specs dd { margin-bottom: 8px; margin-left: 0; }

/* --- Forms --- */
.form-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    max-width: 600px;
}
.form-card h2 { font-size: 22px; margin-bottom: 20px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}
.form-success {
    background: #dcfce7;
    color: #166534;
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 15px;
}

/* --- Contact info --- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.contact-info { background: var(--white); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.contact-info .info-item { display: flex; gap: 14px; margin-bottom: 22px; align-items: flex-start; }
.contact-info .info-item .icon { font-size: 24px; }
.contact-info .info-item h4 { font-size: 15px; margin-bottom: 2px; }
.contact-info .info-item p { color: var(--text-muted); font-size: 14px; }

/* --- About page --- */
.about-section { background: var(--white); border-radius: var(--radius); padding: 40px; box-shadow: var(--shadow); }
.about-section h2 { font-size: 24px; margin-bottom: 16px; }
.about-section p { margin-bottom: 14px; color: var(--text); }

/* --- Pagination --- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 32px; }
.pagination a, .pagination span {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
}
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); }
.pagination .current { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* --- Footer --- */
.site-footer {
    background: var(--dark);
    color: #94a3b8;
    padding: 40px 0 20px;
    margin-top: 60px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}
.footer-grid h4 { color: var(--white); font-size: 16px; margin-bottom: 14px; }
.footer-grid ul { list-style: none; }
.footer-grid ul li { margin-bottom: 8px; }
.footer-grid ul a { color: #94a3b8; font-size: 14px; }
.footer-grid ul a:hover { color: var(--white); }
.footer-grid .about-blurb { font-size: 14px; line-height: 1.7; }
.footer-bottom {
    text-align: center;
    font-size: 13px;
    padding-top: 20px;
    border-top: 1px solid #1e293b;
}

/* --- Flash messages --- */
.flash-msg { margin: 20px 0; }

/* --- Empty state --- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }

/* --- Responsive --- */
@media (max-width: 1024px) {
    .shop-layout { grid-template-columns: 200px 1fr; gap: 24px; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--dark);
        flex-direction: column;
        padding: 16px 20px;
        gap: 0;
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 12px 0; border-bottom: 1px solid #1e293b; }
    .nav-search { max-width: none; order: 3; flex-basis: 100%; }
    .nav-admin { display: none; }
    .hero { padding: 40px 0; }
    .hero h1 { font-size: 24px; }
    .hero p { font-size: 15px; }
    .shop-layout { grid-template-columns: 1fr; }
    .shop-sidebar { position: static; }
    .product-detail { grid-template-columns: 1fr; gap: 24px; }
    .product-detail .product-image .placeholder,
    .product-detail .product-image img { height: 280px; }
    .contact-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .section { padding: 32px 0; }
    .section-title { font-size: 22px; }
}
@media (max-width: 480px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-card .product-img,
    .product-card .product-img-placeholder { height: 140px; }
    .product-card .product-body { padding: 10px; }
    .product-card h3 { font-size: 13px; }
    .product-card .price { font-size: 15px; }
    .product-card .btn { font-size: 12px; padding: 7px 10px; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .container { padding: 0 14px; }
}
