/* ==========================================
   Lemag.kz - Основной стиль
   Тема: Оранжевый (#FF6B00 / #FF8C00)
   Подход: Mobile First
   ========================================== */

/* ===== CSS Variables ===== */
:root {
    --primary: #FF6B00;
    --primary-dark: #E55F00;
    --primary-light: #FF8C00;
    --primary-bg: #FFF0E5;
    --primary-bg-hover: #FFE4CC;
    
    --text-dark: #1a1a1a;
    --text-gray: #666;
    --text-light: #999;
    
    --bg-white: #fff;
    --bg-light: #f9f9f9;
    --bg-gray: #f5f5f5;
    
    --border: #e0e0e0;
    --border-light: #eee;
    
    --success: #28a745;
    --error: #dc3545;
    --warning: #ffc107;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --transition: all 0.3s ease;
    
    --header-height: 70px;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

ul,
ol {
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input,
textarea,
select {
    font-family: inherit;
    font-size: 1rem;
}

/* ===== Container ===== */
.container {
    width: 100%;
    padding: 0 16px;
    margin: 0 auto;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    font-weight: 700;
    margin-bottom: 0.5em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
    margin-bottom: 1rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.4;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-secondary {
    background: var(--text-gray);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--text-dark);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--error);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.05rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-white);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

fieldset.seo-fieldset {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 24px 0;
}

fieldset.seo-fieldset legend {
    padding: 0 10px;
    font-weight: 700;
    color: var(--primary);
}

/* ===== Alerts ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin: 16px;
    font-size: 0.95rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== Header ===== */
.site-header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo svg {
    height: 36px;
    width: auto;
}

.main-nav {
    display: none;
}

.main-nav ul {
    display: flex;
    gap: 24px;
}

.main-nav a {
    color: var(--text-dark);
    font-weight: 600;
    padding: 8px 0;
    position: relative;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary);
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.main-nav a:hover::after {
    width: 100%;
}

.header-actions {
    display: none;
    gap: 10px;
}

.mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 8px;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-dark);
    transition: var(--transition);
}

.mobile-nav {
    display: none;
    background: var(--bg-white);
    border-top: 1px solid var(--border-light);
    padding: 16px 0;
}

.mobile-nav.active {
    display: block;
}

.mobile-nav ul {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-nav a {
    display: block;
    padding: 10px 16px;
    color: var(--text-dark);
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.mobile-nav a:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

/* ===== Main Content ===== */
.main-content {
    min-height: calc(100vh - var(--header-height) - 200px);
}

/* ===== Hero Section ===== */
.hero {
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--primary-bg-hover) 100%);
    padding: 60px 0;
    text-align: center;
}

.hero-title {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-gray);
    max-width: 600px;
    margin: 0 auto 30px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== Sections ===== */
.section {
    padding: 48px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-size: 1.5rem;
    color: var(--text-dark);
}

.section-link {
    color: var(--primary);
    font-weight: 600;
}

.page-title {
    font-size: 2rem;
    margin-bottom: 8px;
}

.page-description {
    color: var(--text-gray);
    margin-bottom: 30px;
}

/* ===== Article Cards ===== */
.articles-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.article-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.article-card-image {
    height: 200px;
    overflow: hidden;
    background: var(--primary-bg);
}

.article-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.article-card:hover .article-card-image img {
    transform: scale(1.05);
}

.article-card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-card-content {
    padding: 20px;
}

.article-card-title {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.article-card-title a {
    color: var(--text-dark);
}

.article-card-title a:hover {
    color: var(--primary);
}

.article-card-excerpt {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 14px;
}

.article-card-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ===== Product Cards ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.product-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-card-link {
    display: block;
    color: inherit;
}

.product-card-image {
    height: 180px;
    overflow: hidden;
    background: var(--bg-light);
}

.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card-content {
    padding: 14px;
}

.product-card-title {
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.product-card-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.price-current {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.price-old {
    font-size: 0.85rem;
    color: var(--text-light);
    text-decoration: line-through;
}

.product-stock {
    font-size: 0.8rem;
    font-weight: 600;
}

.in-stock {
    color: var(--success);
}

.out-of-stock {
    color: var(--error);
}

/* ===== Gallery ===== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.gallery-item {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: var(--bg-white);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.gallery-item figcaption {
    padding: 12px;
    font-size: 0.9rem;
    color: var(--text-gray);
    text-align: center;
}

.gallery-placeholder {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.placeholder-card {
    height: 200px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Coming Soon ===== */
.coming-soon {
    text-align: center;
    padding: 60px 20px;
    background: var(--primary-bg);
    border-radius: var(--radius-lg);
    grid-column: 1 / -1;
}

.coming-soon h3 {
    margin: 20px 0 10px;
}

.coming-soon p {
    color: var(--text-gray);
}

/* ===== Article Full Page ===== */
.article-full {
    padding: 40px 0;
}

.article-header {
    margin-bottom: 30px;
}

.article-title {
    font-size: 2rem;
    margin-bottom: 16px;
}

.article-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.article-image {
    margin-bottom: 30px;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.article-image img {
    width: 100%;
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 800px;
}

.article-content p {
    margin-bottom: 1.5rem;
}

/* ===== Comments ===== */
.comments-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid var(--border-light);
}

.comments-list {
    margin: 30px 0;
}

.comment {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.comment-author {
    font-weight: 700;
    color: var(--primary);
}

.comment-date {
    color: var(--text-light);
    font-size: 0.85rem;
}

.comment-content {
    color: var(--text-dark);
    line-height: 1.6;
}

.comment-form-wrapper {
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-top: 30px;
}

.comment-form-wrapper h3 {
    margin-bottom: 20px;
}

.logged-in-note {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.moderation-note {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
}

/* ===== Auth Pages ===== */
.auth-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height) - 100px);
    padding: 40px 0;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    margin: 0 auto;
}

.auth-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.5rem;
}

.auth-form {
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    color: var(--text-gray);
    font-size: 0.9rem;
}

/* ===== Profile ===== */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.profile-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 30px;
}

.profile-card h2 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

/* ===== Orders ===== */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.order-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.order-meta {
    display: flex;
    gap: 20px;
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.order-items h4 {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.order-items ul {
    list-style: none;
}

.order-items li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

.order-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-pending { background: #fff3cd; color: #856404; }
.status-paid { background: #d4edda; color: #155724; }
.status-processing { background: #cce5ff; color: #004085; }
.status-shipped { background: #e2e3e5; color: #383d41; }
.status-delivered { background: #d4edda; color: #155724; }
.status-cancelled { background: #f8d7da; color: #721c24; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
}

.empty-state h2 {
    margin: 20px 0 10px;
}

.empty-state p {
    color: var(--text-gray);
    margin-bottom: 24px;
}

.empty-message {
    text-align: center;
    color: var(--text-gray);
    padding: 40px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

/* ===== Product Detail ===== */
.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.product-image-wrapper img,
.product-image-placeholder {
    width: 100%;
    border-radius: var(--radius-lg);
}

.product-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-bg);
    min-height: 300px;
}

.product-title {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.product-sku {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.product-price-block {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.price-current-large {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.price-old-large {
    font-size: 1.3rem;
    color: var(--text-light);
    text-decoration: line-through;
}

.product-stock-info {
    margin-bottom: 24px;
}

.stock-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.product-description {
    margin-bottom: 24px;
}

.product-actions {
    margin-bottom: 16px;
}

.coming-soon-note {
    color: var(--text-light);
    font-size: 0.85rem;
    font-style: italic;
}

.product-content-full {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--border-light);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

.pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    border: 2px solid var(--border);
    color: var(--text-dark);
    font-weight: 600;
    transition: var(--transition);
}

.pagination-item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ===== Footer ===== */
.site-footer {
    background: var(--text-dark);
    color: #ccc;
    padding: 60px 0 30px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.footer-col h3 {
    color: var(--primary);
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col a {
    color: #ccc;
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid #333;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ===== Error Pages ===== */
.error-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.error-card {
    text-align: center;
    padding: 40px;
}

.error-title {
    font-size: 2rem;
    margin: 24px 0 12px;
    color: var(--primary);
}

.error-message {
    color: var(--text-gray);
    margin-bottom: 30px;
}

.error-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== Admin Toolbar ===== */
.admin-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-section {
    margin-bottom: 40px;
}

.admin-section h2 {
    margin-bottom: 16px;
}

.admin-form-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.image-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.image-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.image-info {
    padding: 12px;
}

.image-card form {
    padding: 12px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 10px;
    font-size: 0.75rem;
    margin-top: 4px;
}

.text-muted {
    color: var(--text-light);
    font-size: 0.85rem;
}

.role-admin {
    color: var(--primary);
    font-weight: 700;
}

.role-user {
    color: var(--text-gray);
}

/* ===== Responsive: Tablet (768px+) ===== */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
    
    h1 { font-size: 2.25rem; }
    h2 { font-size: 1.75rem; }
    
    .main-nav {
        display: block;
    }
    
    .header-actions {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: none;
    }
    
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .gallery-grid,
    .gallery-placeholder {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .profile-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .product-detail-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .images-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== Responsive: Desktop (1024px+) ===== */
@media (min-width: 1024px) {
    .container {
        max-width: 1140px;
    }
    
    .articles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .gallery-grid,
    .gallery-placeholder {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .images-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== Responsive: Large Desktop (1280px+) ===== */
@media (min-width: 1280px) {
    .container {
        max-width: 1200px;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-content {
    animation: fadeIn 0.3s ease;
}

/* ===== Print Styles ===== */
@media print {
    .site-header,
    .site-footer,
    .mobile-nav,
    .btn {
        display: none !important;
    }
}