/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    background: #f5f5f5;
    min-height: 100vh;
    position: relative;
    padding-bottom: 80px;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.header-main {
    text-align: left;
}

.app-header h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
}

/* Header Auth */
.header-auth {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.user-badge {
    background: rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 20px;
}

.header-auth a {
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.header-auth a:hover {
    background: rgba(255,255,255,0.2);
}

.admin-link {
    background: rgba(255,255,255,0.1);
}

.logout-link {
    opacity: 0.9;
}

.login-link {
    background: rgba(255,255,255,0.2);
    font-weight: 500;
}

/* Wizard Progress */
.wizard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background: white;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.progress-step.active .step-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.step-label {
    font-size: 12px;
    color: #666;
}

.progress-step.active .step-label {
    color: #667eea;
    font-weight: 600;
}

.progress-line {
    width: 80px;
    height: 2px;
    background: #e0e0e0;
    margin: 0 10px;
    margin-bottom: 20px;
}

.help-text {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
}

/* AI Analysis */
.ai-loading {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-result {
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ai-result h3 {
    margin-bottom: 10px;
    color: #667eea;
    font-size: 16px;
}

.ai-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

textarea.ai-input {
    resize: vertical;
    min-height: 150px;
}

.description-preview {
    background: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.gallery-photo {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-photo:hover {
    transform: scale(1.05);
}

/* Platform Status */
.platform-status {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: white;
    margin: 15px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.status-card {
    flex: 1;
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: white;
}

.status-number {
    display: block;
    font-size: 32px;
    font-weight: bold;
}

.status-label {
    display: block;
    font-size: 12px;
    opacity: 0.9;
    margin-top: 5px;
}

/* Platforms List */
.platforms-list {
    padding: 20px;
    background: white;
    margin: 15px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.platforms-list h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
}

.platform-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.platform-badge {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.platform-badge.active {
    background: #10b981;
    color: white;
}

.platform-badge.inactive {
    background: #f59e0b;
    color: white;
}

/* Post Form */
.post-form-container {
    padding: 20px;
    background: white;
    margin: 15px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.char-counter {
    text-align: right;
    font-size: 12px;
    color: #6b7280;
    margin-top: 5px;
}

.file-label {
    display: block;
    padding: 15px;
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-label:hover {
    background: #e5e7eb;
    border-color: #667eea;
}

.file-label input[type="file"] {
    display: none;
}

.image-preview {
    margin-top: 15px;
}

.image-preview img {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn-post {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-post:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-post:active {
    transform: translateY(0);
}

.btn-post:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* Results */
.results-container {
    padding: 20px;
    background: white;
    margin: 15px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.result-item {
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-item.success {
    background: #d1fae5;
    border: 1px solid #10b981;
}

.result-item.error {
    background: #fee2e2;
    border: 1px solid #ef4444;
}

.result-icon {
    font-size: 20px;
}

.result-text {
    flex: 1;
}

.result-platform {
    font-weight: 600;
    margin-bottom: 3px;
}

.result-message {
    font-size: 13px;
    color: #6b7280;
}

/* Feed */
.feed-container {
    padding: 20px;
    background: white;
    margin: 15px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.feed-header h3 {
    font-size: 18px;
    color: #333;
}

.btn-refresh {
    padding: 8px 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-refresh:hover {
    background: #5568d3;
}

.feed-content {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.interaction-item {
    padding: 15px;
    margin-bottom: 15px;
    background: #f9fafb;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

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

.interaction-platform {
    display: inline-block;
    padding: 4px 10px;
    background: #667eea;
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.interaction-time {
    font-size: 12px;
    color: #9ca3af;
}

.interaction-author {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.interaction-content {
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

.interaction-type {
    display: inline-block;
    margin-top: 8px;
    padding: 3px 8px;
    background: #e5e7eb;
    color: #6b7280;
    border-radius: 6px;
    font-size: 11px;
    text-transform: uppercase;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

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

.empty-state-text {
    font-size: 16px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 600px;
    width: 100%;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #9ca3af;
    padding: 5px 20px;
    transition: all 0.3s;
}

.nav-item.active {
    color: #667eea;
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 3px;
}

.nav-label {
    font-size: 12px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 600px) {
    .app-container {
        max-width: 100%;
    }
    
    .platform-status,
    .platforms-list,
    .post-form-container,
    .results-container,
    .feed-container {
        margin: 10px;
        border-radius: 10px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-item,
.interaction-item {
    animation: fadeIn 0.3s ease-out;
}

/* Success Message */
.success-message {
    padding: 15px;
    background: #d1fae5;
    border: 1px solid #10b981;
    border-radius: 10px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
    color: #065f46;
}

.error-message {
    padding: 15px;
    background: #fee2e2;
    border: 1px solid #ef4444;
    border-radius: 10px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
    color: #991b1b;
}

/* Marketplace Styles */

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: white;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.filter-tab {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.filter-tab.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* Multiple image preview */
.image-preview {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}

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

.heic-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    font-size: 32px;
}

.heic-placeholder small {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
}

.remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}

.remove-image:hover {
    background: #dc2626;
}

/* Listings Container */
.listings-container,
.messages-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 80px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.listings-header,
.messages-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f3f4f6;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.listings-content,
.messages-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Listing Card */
.listing-card {
    position: relative;
    background: #f9fafb;
    border-radius: 12px;
    padding: 15px;
    border: 2px solid #e5e7eb;
    transition: all 0.2s;
}

.listing-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.listing-checkbox {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.listing-image {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

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

.listing-details h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #1f2937;
}

.listing-price {
    font-size: 24px;
    font-weight: 700;
    color: #10b981;
    margin: 0 0 10px 0;
}

.listing-description {
    color: #6b7280;
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.listing-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    font-size: 14px;
}

.listing-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-sold {
    background: #e5e7eb;
    color: #6b7280;
}

.listing-platforms,
.listing-date {
    color: #6b7280;
}

.listing-platform-links {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.platform-link {
    display: inline-block;
    padding: 4px 10px;
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 4px;
    font-size: 12px;
    text-decoration: none;
}

.platform-link:hover {
    background: #bae6fd;
}

.listing-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Bulk Update Section */
.bulk-update-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.bulk-update-form h3 {
    margin: 0 0 15px 0;
}

.bulk-update-form textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 15px;
}

.bulk-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Message Card */
.message-card {
    background: #f9fafb;
    border-radius: 12px;
    padding: 15px;
    border: 2px solid #e5e7eb;
    position: relative;
    transition: all 0.2s;
}

.message-card.unread {
    border-color: #3b82f6;
    background: #eff6ff;
}

.message-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.message-platform {
    font-weight: 700;
    color: #3b82f6;
    font-size: 14px;
}

.message-time {
    color: #9ca3af;
    font-size: 12px;
}

.message-listing {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 8px;
}

.message-sender {
    color: #374151;
    font-size: 14px;
    margin-bottom: 8px;
}

.message-content {
    color: #1f2937;
    font-size: 15px;
    line-height: 1.6;
    margin-top: 10px;
}

.unread-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #3b82f6;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
}

.empty-state p {
    font-size: 18px;
    margin: 10px 0;
}

.empty-state .subtitle {
    font-size: 14px;
    color: #d1d5db;
}

/* Button Variations */
.btn-danger {
    background: #ef4444;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Input field styles for marketplace */
input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-family: inherit;
    font-size: 16px;
    transition: all 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .filter-tabs {
        flex-direction: column;
    }
    
    .header-actions {
        flex-direction: column;
    }
    
    .listing-actions {
        flex-direction: column;
    }
    
    .bulk-actions {
        flex-direction: column;
    }
}

/* Screen reader only text for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
