/* Global Reset & Variables */
:root {
    --bg-color: #0d0e12;
    --card-bg: rgba(22, 24, 35, 0.6);
    --card-glass: rgba(20, 20, 25, 0.4);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-glow: rgba(168, 85, 247, 0.2);
    
    --text-main: #f1f3f5;
    --text-muted: #9e9ea7;
    
    --accent-purple: #a855f7;
    --accent-purple-hover: #b575f9;
    --accent-purple-glow: rgba(168, 85, 247, 0.4);
    --accent-gold: #f59e0b;
    --accent-gold-hover: #fbbf24;
    --accent-red: #ef4444;
    
    --sidebar-width: 320px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
}

/* App Container Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: radial-gradient(circle at 70% 30%, rgba(168, 85, 247, 0.08) 0%, rgba(13, 14, 18, 1) 70%);
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: rgba(15, 16, 21, 0.85);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    color: var(--accent-purple);
    filter: drop-shadow(0 0 8px var(--accent-purple-glow));
}

.brand h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.brand h1 span {
    color: var(--accent-purple);
    text-shadow: 0 0 10px var(--accent-purple-glow);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border: 1px solid transparent;
    background: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
}

.nav-btn i {
    width: 20px;
    height: 20px;
}

.nav-btn:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    color: var(--text-main);
    background-color: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.3);
}

.nav-btn.btn-primary {
    background-color: var(--accent-purple);
    color: white;
    margin-top: 10px;
    border: none;
    box-shadow: 0 4px 15px var(--accent-purple-glow);
}

.nav-btn.btn-primary:hover {
    background-color: var(--accent-purple-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-purple-glow);
}

/* Filters Section */
.filters-section {
    flex: 1;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
}

.filters-section h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

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

.filter-group label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.filter-group input, 
.filter-group select {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 14px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
}

.filter-group input:focus, 
.filter-group select:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 2px var(--accent-purple-glow);
}

.price-input-container {
    display: flex;
    gap: 8px;
}

.price-input-container input {
    flex: 1;
}

.price-input-container select {
    width: 80px;
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-family: var(--font-body);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--text-muted);
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* Main Content Styling */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

/* Mobile Header */
.mobile-header {
    display: none;
    height: 60px;
    background-color: rgba(15, 16, 21, 0.9);
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    z-index: 99;
}

.mobile-nav-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.icon-btn.primary {
    background-color: var(--accent-purple);
    border: none;
}

/* View Sections */
.view-section {
    display: none;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

.view-section.active {
    display: flex;
    flex-direction: column;
}

/* TikTok Feed View */
.tiktok-feed {
    flex: 1;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #050508;
    height: 100%;
}

/* Hide scrollbars for vertical feed */
.tiktok-feed::-webkit-scrollbar {
    display: none;
}
.tiktok-feed {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Empty state */
.feed-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    color: var(--text-muted);
    padding: 20px;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    color: var(--accent-purple);
    opacity: 0.5;
}

.feed-empty-state h2 {
    margin-bottom: 8px;
    color: var(--text-main);
}

/* TikTok Card Item */
.tiktok-card {
    scroll-snap-align: start;
    scroll-snap-stop: always;
    width: 100%;
    max-width: 500px;
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

/* Image/Media Container */
.media-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.media-slides {
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
}

/* Left / Right Carousel Controls */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.4);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s;
}

.media-container:hover .carousel-btn {
    opacity: 1;
}

.carousel-btn.prev { left: 16px; }
.carousel-btn.next { right: 16px; }

.carousel-indicators {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

.indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s;
}

.indicator.active {
    background-color: var(--accent-purple);
    width: 18px;
    border-radius: 3px;
}

/* Overlay Glass Info (Bottom) */
.card-overlay-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.5) 60%, transparent 100%);
    padding: 30px 80px 30px 24px;
    z-index: 5;
    pointer-events: none;
}

.price-tag {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    color: var(--accent-purple);
    text-shadow: 0 2px 10px rgba(168, 85, 247, 0.5);
    margin-bottom: 6px;
    pointer-events: auto;
}

.listing-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
    color: white;
}

.listing-location {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.listing-location i {
    width: 14px;
    height: 14px;
    color: var(--accent-purple);
}

.specs-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    pointer-events: auto;
}

.spec-badge {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.spec-badge i {
    width: 12px;
    height: 12px;
}

.listing-desc-short {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    max-height: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    pointer-events: auto;
    cursor: pointer;
    transition: color 0.2s;
}

.listing-desc-short:hover {
    color: white;
}

/* Floating Actions Sidebar (Right Side of Card) */
.card-actions-sidebar {
    position: absolute;
    right: 12px;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    z-index: 10;
}

.action-btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.card-action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(30, 31, 38, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-action-btn:hover {
    transform: scale(1.1);
    background-color: var(--accent-purple);
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px var(--accent-purple-glow);
}

.card-action-btn.active {
    color: var(--accent-purple);
}

.card-action-btn.favorite-btn.active {
    color: var(--accent-red);
    background-color: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.card-action-btn.export-btn {
    background-color: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--accent-gold);
}

.card-action-btn.export-btn:hover {
    background-color: var(--accent-gold);
    color: black;
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.action-btn-wrapper span {
    font-size: 11px;
    font-weight: 500;
    color: #e2e8f0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Grid View Section */
#grid-view {
    padding: 30px;
    overflow-y: auto;
}

.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.grid-header h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 26px;
}

.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* Grid Card Item */
.grid-item-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
    position: relative;
}

.grid-item-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-purple-glow);
    box-shadow: 0 10px 25px rgba(168, 85, 247, 0.15);
}

.grid-card-media {
    height: 180px;
    position: relative;
}

.grid-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-price-badge {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background-color: rgba(0, 0, 0, 0.75);
    border: 1px solid var(--accent-purple);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    color: var(--accent-purple);
}

.grid-card-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.grid-card-favorite.active {
    color: var(--accent-red);
}

.grid-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.grid-card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 40px;
}

.grid-card-loc {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.grid-card-specs {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.grid-card-specs span {
    font-size: 11px;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--text-muted);
}

.grid-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.grid-card-actions button {
    flex: 1;
    padding: 8px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Modals Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #12131a;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: white;
}

/* Form layouts */
.modal-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

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

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input, 
.form-group textarea, 
.form-group select {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
}

.form-group input:focus, 
.form-group textarea:focus, 
.form-group select:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 2px var(--accent-purple-glow);
}

/* Upload zone */
.image-upload-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background-color: rgba(255, 255, 255, 0.02);
}

.image-upload-zone:hover, 
.image-upload-zone.dragover {
    border-color: var(--accent-purple);
    background-color: rgba(168, 85, 247, 0.05);
}

.image-upload-zone i {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.image-upload-zone p {
    font-size: 13px;
    color: var(--text-muted);
}

.image-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.image-preview-item {
    position: relative;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .remove-preview-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

/* OLX Export Assistant Styling */
.export-modal-content {
    max-width: 600px;
}

.export-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.export-step-box {
    display: flex;
    gap: 16px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 12px;
}

.step-badge {
    background-color: var(--accent-purple);
    color: white;
    font-weight: 700;
    font-size: 12px;
    height: 24px;
    padding: 0 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.step-desc {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-desc h4 {
    font-size: 15px;
    font-weight: 600;
}

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

.download-zip-btn {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
}

.copy-fields-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 6px;
}

.copy-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.copy-fields-row {
    display: flex;
    gap: 12px;
}

.copy-fields-row .copy-field {
    flex: 1;
}

.field-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.copy-input-group {
    display: flex;
}

.copy-input-group input {
    flex: 1;
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
    color: var(--text-main);
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
}

.btn-copy {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-left: none;
    color: var(--text-main);
    width: 36px;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-copy:hover {
    background-color: var(--accent-purple);
    color: white;
}

.description-copy-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.description-copy-container textarea {
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px;
    font-family: var(--font-body);
    font-size: 13px;
    border-radius: 8px;
    resize: none;
    outline: none;
}

.link-olx {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 13px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Toast Container */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    background-color: #1a1b24;
    border-left: 4px solid var(--accent-purple);
    color: white;
    padding: 14px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }

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

/* Scroll Snap Helpers */
.hidden {
    display: none !important;
}

/* Responsive styles */
@media (max-width: 900px) {
    .sidebar {
        display: none;
    }
    
    .mobile-header {
        display: flex;
    }

    .app-container {
        flex-direction: column;
    }
    
    .main-content {
        height: calc(100vh - 60px);
    }
    
    .tiktok-card {
        max-width: 100%;
        height: calc(100vh - 60px);
    }
}
