/* ===== Phone Store — Современный дизайн ===== */

:root {
    --primary: #1e3a5f;
    --primary-dark: #0f2744;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --info: #3b82f6;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Header ===== */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-accent {
    color: var(--accent);
}

.nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-link {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 15px;
    transition: color var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--accent);
}

.cart-link {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart-badge {
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    min-width: 22px;
    text-align: center;
}

/* ===== Flash messages ===== */
.flash-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.flash {
    padding: 14px 18px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    font-size: 14px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.flash-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    line-height: 1;
}

.flash-close:hover { opacity: 1; }

/* ===== Main ===== */
.main {
    flex: 1;
}

/* ===== Hero ===== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.hero h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.hero p {
    font-size: 17px;
    opacity: 0.9;
    max-width: 500px;
    margin: 0 auto;
}

/* ===== Advantages ===== */
.advantages {
    padding: 40px 0;
    margin-top: -30px;
}

.advantages-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.advantage-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}

.advantage-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.advantage-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.advantage-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.advantage-card p {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Catalog ===== */
.catalog {
    padding: 20px 0 60px;
}

.catalog-header {
    margin-bottom: 24px;
}

.catalog-header h2 {
    font-size: 26px;
    font-weight: 700;
}

/* Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
    align-items: center;
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.search-group {
    flex: 1;
    min-width: 220px;
}

.search-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    cursor: pointer;
    min-width: 160px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Products grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.product-image-link {
    display: block;
    background: #f8fafc;
}

.product-image {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-brand {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 8px;
    display: block;
    transition: color var(--transition);
}

.product-name:hover {
    color: var(--accent);
}

.product-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.product-specs span {
    font-size: 12px;
    background: var(--bg);
    padding: 3px 8px;
    border-radius: 6px;
    color: var(--text-muted);
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    gap: 10px;
}

.product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-cart {
    background: var(--primary);
    color: white;
    padding: 8px 14px;
    font-size: 13px;
}

.btn-cart:hover {
    background: var(--primary-dark);
}

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* ===== Product detail ===== */
.product-detail {
    padding: 30px 0 60px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.product-detail-image {
    background: #f8fafc;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    aspect-ratio: 1;
}

.product-detail-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-title {
    font-size: 28px;
    font-weight: 700;
    margin: 8px 0 16px;
}

.product-price-large {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
}

.product-description {
    margin-bottom: 24px;
    color: var(--text-muted);
    font-size: 15px;
}

.specs-table {
    margin-bottom: 28px;
}

.specs-table h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.specs-table table {
    width: 100%;
    border-collapse: collapse;
}

.specs-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.specs-table td:first-child {
    color: var(--text-muted);
    width: 40%;
}

.specs-table td:last-child {
    font-weight: 500;
}

/* ===== Cart ===== */
.cart-section, .checkout-section {
    padding: 30px 0 60px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 28px;
}

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 28px;
    align-items: start;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cart-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    display: grid;
    grid-template-columns: 80px 1fr auto auto auto;
    gap: 16px;
    align-items: center;
    box-shadow: var(--shadow);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cart-item-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cart-item-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.cart-item-price {
    font-size: 13px;
    color: var(--text-muted);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-form {
    display: inline;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.qty-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.qty-value {
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.cart-item-total {
    font-weight: 700;
    font-size: 16px;
    min-width: 100px;
    text-align: right;
}

.btn-remove {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    transition: color var(--transition);
}

.btn-remove:hover {
    color: var(--error);
}

.cart-summary {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 90px;
}

.cart-summary h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.total-row {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 8px;
    margin-bottom: 20px;
}

.total-price {
    color: var(--primary);
}

/* ===== Checkout ===== */
.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
}

.checkout-form-wrapper {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.order-summary {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 90px;
}

.order-summary h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.order-items {
    list-style: none;
    margin-bottom: 16px;
}

.order-items li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    gap: 12px;
}

.order-items li span:last-child {
    white-space: nowrap;
    font-weight: 500;
}

.order-total {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 700;
    padding-top: 12px;
}

/* ===== Empty state ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ===== Footer ===== */
.footer {
    background: var(--primary);
    color: rgba(255, 255, 255, 0.8);
    padding: 40px 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-brand .logo-text {
    color: white;
    font-size: 20px;
}

.footer-brand p {
    font-size: 13px;
    margin-top: 6px;
    opacity: 0.7;
}

.footer-info {
    text-align: right;
    font-size: 13px;
    opacity: 0.7;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .advantages-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 24px;
    }

    .cart-layout,
    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .cart-item {
        grid-template-columns: 70px 1fr;
        gap: 12px;
    }

    .cart-item-qty,
    .cart-item-total {
        grid-column: 2;
    }
}

@media (max-width: 600px) {
    .hero h1 {
        font-size: 26px;
    }

    .advantages-grid {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select {
        width: 100%;
    }

    .header-inner {
        height: 60px;
    }

    .logo-text {
        font-size: 18px;
    }

    .footer-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .footer-info {
        text-align: center;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }
}


/* ===== Light and dark themes ===== */
.theme-toggle {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    transition: background var(--transition), color var(--transition),
                border-color var(--transition), transform var(--transition);
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(12deg);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --primary: #172b45;
    --primary-dark: #0f1f33;
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --bg: #111827;
    --card-bg: #1f2937;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --border: #374151;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25),
              0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3),
                 0 4px 6px -4px rgba(0, 0, 0, 0.25);
}

:root[data-theme="dark"] .filter-select,
:root[data-theme="dark"] .qty-btn,
:root[data-theme="dark"] .search-input,
:root[data-theme="dark"] .form-group input,
:root[data-theme="dark"] .form-group textarea {
    background: #111827;
    color: var(--text);
    border-color: var(--border);
}

:root[data-theme="dark"] .product-image-link,
:root[data-theme="dark"] .product-detail-image,
:root[data-theme="dark"] .cart-item-image {
    background: #273449;
}

:root[data-theme="dark"] .product-price,
:root[data-theme="dark"] .product-price-large,
:root[data-theme="dark"] .total-price {
    color: #93c5fd;
}

:root[data-theme="dark"] .flash-success {
    background: #123528;
    color: #a7f3d0;
    border-color: #166534;
}

:root[data-theme="dark"] .flash-error {
    background: #3b1d24;
    color: #fecaca;
    border-color: #7f1d1d;
}

:root[data-theme="dark"] .flash-info {
    background: #172d4a;
    color: #bfdbfe;
    border-color: #1e40af;
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle {
        transition: none;
    }
}
