:root {
    --brand: #00AAFF;
    --brand-2: #0088CC;
    --accent: #FF6B00;
    --bg: #F4F5F7;
    --surface: #FFFFFF;
    --text: #1A1A1A;
    --muted: #7A7A7A;
    --border: #E0E2E6;
    --success: #0D7C2E;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

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

/* Header */
.header {
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    border-bottom: 1px solid var(--border);
}

.top-nav {
    display: flex;
    gap: 24px;
    padding: 10px 0;
    font-size: 14px;
}

.top-nav-link {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

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

.header-main {
    padding: 16px 0;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.search-block {
    flex: 1;
    max-width: 680px;
}

.search-form {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.search-form:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 170, 255, 0.1);
    border-color: var(--brand);
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    background: var(--brand);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.2s;
}

.category-btn:hover {
    background: var(--brand-2);
}

.search-input {
    flex: 1;
    border: none;
    padding: 14px 20px;
    font-size: 15px;
    outline: none;
}

.search-input::placeholder {
    color: var(--muted);
}

.search-btn {
    padding: 0 32px;
    background: transparent;
    border: none;
    color: var(--brand);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.search-btn:hover {
    background: rgba(0, 170, 255, 0.08);
}

.btn-add {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--success);
    color: white;
    text-decoration: none;
    border-radius: 24px;
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 124, 46, 0.3);
}

/* Categories */
.categories-section {
    padding: 32px 0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 16px;
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border);
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--brand);
}

.category-icon {
    font-size: 40px;
}

.category-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-align: center;
}

/* Ads Section */
.ads-section {
    padding: 40px 0 80px;
}

.section-title {
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--text);
}

.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.ad-card {
    position: relative;
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ad-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.ad-image-link {
    display: block;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--bg);
}

.ad-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

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

.ad-content {
    padding: 16px;
}

.ad-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ad-title:hover {
    color: var(--brand);
}

.ad-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.ad-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--muted);
}

.ad-location {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ad-fav {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    color: var(--muted);
}

.ad-fav:hover {
    transform: scale(1.1);
    background: white;
    color: var(--accent);
}

.ad-fav.active {
    color: var(--accent);
}

.ad-fav.active path {
    fill: var(--accent);
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 0;
    font-size: 14px;
    color: var(--muted);
}

.breadcrumbs a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--brand);
}

.breadcrumb-sep {
    color: var(--border);
}

/* Catalog */
.catalog-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 32px;
    padding: 20px 0 80px;
}

.catalog-sidebar {
    position: sticky;
    top: 120px;
    align-self: start;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.category-list {
    list-style: none;
}

.category-list-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text);
    border-radius: 16px;
    transition: background 0.2s, color 0.2s;
    font-size: 15px;
}

.category-list-link:hover {
    background: rgba(0, 170, 255, 0.08);
    color: var(--brand);
}

.category-list-link.active {
    background: var(--brand);
    color: white;
    font-weight: 600;
}

.cat-list-icon {
    font-size: 20px;
}

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.catalog-title {
    font-size: clamp(28px, 5vw, 36px);
    font-weight: 700;
}

.catalog-count {
    color: var(--muted);
    font-size: 14px;
}

.catalog-controls {
    margin-bottom: 32px;
}

.sort-tabs {
    display: flex;
    gap: 12px;
    padding: 6px;
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border);
}

.sort-tab {
    padding: 10px 20px;
    border-radius: 16px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.sort-tab:hover {
    background: rgba(0, 170, 255, 0.08);
}

.sort-tab.active {
    background: var(--brand);
    color: white;
}

/* Ad Detail */
.ad-detail-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 32px;
    padding: 20px 0 40px;
}

.ad-gallery {
    background: var(--surface);
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 24px;
}

.ad-gallery-main {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
}

.ad-detail-card {
    background: var(--surface);
    padding: 32px;
    border-radius: 24px;
    border: 1px solid var(--border);
}

.ad-detail-title {
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
}

.ad-detail-price {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
}

.ad-detail-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--muted);
}

.ad-detail-meta-row > * {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ad-detail-description h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.ad-detail-description p {
    line-height: 1.7;
    color: var(--text);
}

.ad-detail-aside {
    position: sticky;
    top: 120px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.seller-card {
    background: var(--surface);
    padding: 24px;
    border-radius: 24px;
    border: 1px solid var(--border);
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 12px;
}

.seller-avatar {
    flex-shrink: 0;
}

.seller-name {
    font-weight: 600;
    font-size: 16px;
}

.seller-reg {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.btn-contact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    background: var(--brand);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-contact:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 170, 255, 0.3);
}

.btn-phone {
    background: white;
    color: var(--brand);
    border: 2px solid var(--brand);
}

.btn-phone:hover {
    background: rgba(0, 170, 255, 0.08);
    box-shadow: none;
}

.btn-fav-large {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    background: white;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

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

.btn-fav-large.active {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-fav-large.active path {
    fill: var(--accent);
}

.related-section {
    padding: 60px 0;
}

.ads-grid--4 {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--surface);
    padding: 32px;
    border-radius: 24px;
    max-width: 480px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--muted);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text);
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-ad-name {
    color: var(--muted);
    margin-bottom: 24px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 170, 255, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.success-msg {
    padding: 16px 20px;
    background: rgba(13, 124, 46, 0.1);
    color: var(--success);
    border-radius: 16px;
    font-weight: 500;
}

.error-msg {
    padding: 16px 20px;
    background: rgba(255, 59, 48, 0.1);
    color: #d32f2f;
    border-radius: 16px;
    font-weight: 500;
    margin-bottom: 16px;
}

/* Forms */
.form-page {
    max-width: 700px;
    margin: 40px auto 80px;
    background: var(--surface);
    padding: 48px;
    border-radius: 24px;
    border: 1px solid var(--border);
}

.form-page-title {
    font-size: clamp(28px, 5vw, 36px);
    font-weight: 700;
    margin-bottom: 32px;
}

.add-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

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

.form-hint {
    font-size: 13px;
    color: var(--muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.btn-submit {
    padding: 16px 32px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(13, 124, 46, 0.3);
}

/* Profile */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40px 0 32px;
}

.profile-title {
    font-size: clamp(28px, 5vw, 36px);
    font-weight: 700;
    margin-bottom: 8px;
}

.profile-subtitle {
    color: var(--muted);
    font-size: 16px;
}

.my-ads-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 80px;
}

.my-ad-item {
    display: grid;
    grid-template-columns: 180px 1fr auto;
    gap: 24px;
    padding: 20px;
    background: var(--surface);
    border-radius: 24px;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s;
}

.my-ad-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.my-ad-image {
    display: block;
    aspect-ratio: 4/3;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg);
}

.my-ad-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.my-ad-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.my-ad-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    line-height: 1.4;
}

.my-ad-title:hover {
    color: var(--brand);
}

.my-ad-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.my-ad-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--muted);
}

.my-ad-views {
    display: flex;
    align-items: center;
    gap: 4px;
}

.my-ad-actions {
    display: flex;
    align-items: center;
}

.btn-delete {
    padding: 10px 20px;
    background: transparent;
    color: #d32f2f;
    border: 1px solid #d32f2f;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-delete:hover {
    background: rgba(211, 47, 47, 0.08);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.empty-state p {
    color: var(--muted);
    font-size: 16px;
    margin-bottom: 12px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--brand);
    color: white;
    text-decoration: none;
    border-radius: 24px;
    font-weight: 600;
    margin-top: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 170, 255, 0.3);
}

/* Search */
.search-header {
    padding: 24px 0 40px;
}

.search-query {
    font-size: 18px;
    margin: 12px 0;
}

.search-count {
    color: var(--muted);
    font-size: 15px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(0, 170, 255, 0.1);
    color: var(--brand);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.muted {
    color: var(--muted);
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 48px 0 32px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 48px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.footer-copy {
    color: var(--muted);
    font-size: 14px;
}

.footer-heading {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--brand);
}

/* Responsive */
@media (max-width: 1024px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .search-block {
        order: 3;
        flex-basis: 100%;
        max-width: none;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .ads-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .catalog-layout {
        grid-template-columns: 1fr;
    }
    
    .catalog-sidebar {
        position: static;
        order: 2;
    }
    
    .ad-detail-layout {
        grid-template-columns: 1fr;
    }
    
    .ad-detail-aside {
        position: static;
        order: 1;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .form-page {
        padding: 32px 24px;
    }
    
    .my-ad-item {
        grid-template-columns: 1fr;
    }
    
    .my-ad-image {
        width: 100%;
    }
    
    .my-ad-actions {
        justify-content: flex-start;
    }
    
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .modal {
        padding: 24px;
    }
}

@media (max-width: 640px) {
    .header-top {
        display: none;
    }
    
    .logo-text {
        font-size: 20px;
    }
    
    .btn-add span {
        display: none;
    }
    
    .btn-add {
        padding: 12px;
        border-radius: 50%;
    }
    
    .category-btn span {
        display: none;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .category-card {
        padding: 16px 8px;
    }
    
    .category-icon {
        font-size: 32px;
    }
    
    .category-name {
        font-size: 12px;
    }
    
    .ads-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .category-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .category-list-link {
        font-size: 13px;
        padding: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}