/* Mobile-First Trading Page Styles */

/* ========== CONTAINER & BASE ========== */
.trading-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem;
    min-height: calc(100vh - 200px);
}

.trading-view {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.trading-view.active {
    display: block;
}

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

/* ========== BROWSE VIEW ========== */
.browse-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.browse-title {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #4a9eff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-create-trade {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #667eea, #4a9eff);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
}

.btn-create-trade:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.btn-create-trade:active {
    transform: scale(0.98);
}

.browse-filters {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    pointer-events: none;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: CanvasText;
    font-size: 0.95rem;
    transition: all 0.3s;
    min-height: 44px;
}

.search-input:focus {
    outline: none;
    background: var(--bg-item-hover);
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem 1rem;
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: CanvasText;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 44px;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Trade Cards Grid */
.trades-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.trade-card {
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    transition: all 0.3s;
    cursor: pointer;
}

.trade-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
    border-color: #667eea;
}

.trade-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.trader-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.trader-info {
    flex: 1;
    min-width: 0;
}

.trader-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    color: CanvasText;
}

.trader-stats {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.trade-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.trade-status {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--bg-item-hover);
    border: 1px solid var(--border-color);
}

.trade-status.active {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    color: #667eea;
}

.trade-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: CanvasText;
}

.trade-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.trade-items-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.trade-side {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.trade-side-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.trade-items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.trade-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-item-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
}

.trade-item-img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 6px;
}

.trade-item-name {
    font-weight: 600;
    color: CanvasText;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trade-item-robux {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: linear-gradient(135deg, rgba(17, 245, 74, 0.2), rgba(102, 126, 234, 0.2));
    border: 1px solid rgba(17, 245, 74, 0.3);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    color: #11f54a;
}

.trade-item-other {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-item-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
}

.trade-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-view {
    flex: 1;
    padding: 0.625rem 1rem;
    background: linear-gradient(135deg, #667eea, #4a9eff);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 44px;
}

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

.btn-offer {
    flex: 1;
    padding: 0.625rem 1rem;
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: CanvasText;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 44px;
}

.btn-offer:hover {
    background: var(--bg-item-hover);
    border-color: #667eea;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: CanvasText;
}

.empty-state-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========== WIZARD ========== */
.wizard-container {
    max-width: 800px;
    margin: 0 auto;
}

.wizard-progress {
    position: relative;
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 2;
    flex: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-item);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.progress-step.active .step-number {
    background: linear-gradient(135deg, #667eea, #4a9eff);
    border-color: #667eea;
    color: white;
}

.progress-step.completed .step-number {
    background: #11f54a;
    border-color: #11f54a;
    color: white;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

.progress-step.active .step-label {
    color: CanvasText;
}

.progress-bar {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    z-index: 1;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #4a9eff);
    transition: width 0.3s ease;
    width: 0%;
}

.wizard-step {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.wizard-step.active {
    display: block;
}

.step-header {
    margin-bottom: 2rem;
}

.step-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: CanvasText;
}

.step-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.step-content {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: CanvasText;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: CanvasText;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s;
    min-height: 44px;
}

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

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    background: var(--bg-item-hover);
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.items-section {
    margin-bottom: 2rem;
}

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.btn-add-custom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: CanvasText;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 44px;
}

.btn-add-custom:hover {
    background: var(--bg-item-hover);
    border-color: #667eea;
}

.item-search-container {
    position: relative;
    margin-bottom: 1rem;
}

.item-search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: CanvasText;
    font-size: 0.95rem;
    transition: all 0.3s;
    min-height: 44px;
}

.item-search-input::before {
    content: '🔍';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

.item-search-input:focus {
    outline: none;
    background: var(--bg-item-hover);
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.item-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.item-search-results.active {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-item-hover);
}

.search-result-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}

.search-result-item-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: CanvasText;
}

.selected-items-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-height: 60px;
    padding: 1rem;
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.selected-items-container .empty-state {
    width: 100%;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.selected-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-item-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    position: relative;
}

.selected-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}

.selected-item-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: CanvasText;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-item-remove {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.2);
    border: none;
    color: #ff4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    transition: all 0.2s;
    flex-shrink: 0;
}

.selected-item-remove:hover {
    background: rgba(255, 0, 0, 0.3);
}

.selected-item-robux,
.selected-item-other {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-item-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
}

.selected-item-robux {
    background: linear-gradient(135deg, rgba(17, 245, 74, 0.2), rgba(102, 126, 234, 0.2));
    border-color: rgba(17, 245, 74, 0.3);
    color: #11f54a;
}

.step-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    background: Canvas;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-bottom: 1rem;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #4a9eff);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    color: CanvasText;
}

.btn-secondary:hover {
    background: var(--bg-item-hover);
    border-color: #667eea;
}

/* Step 3 Specific Styles */
.step-3-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.details-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.theme-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-item);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.theme-option:hover {
    background: var(--bg-item-hover);
    border-color: #667eea;
}

.theme-option.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.theme-preview {
    width: 60px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.theme-default {
    background: linear-gradient(135deg, #667eea, #4a9eff);
}

.theme-ocean {
    background: linear-gradient(135deg, #00c9ff, #92fe9d);
}

.theme-sunset {
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
}

.theme-forest {
    background: linear-gradient(135deg, #11998e, #38ef7d);
}

.theme-option span {
    font-size: 0.875rem;
    font-weight: 600;
    color: CanvasText;
}

.preview-column {
    display: none;
}

.preview-container {
    position: sticky;
    top: 1rem;
}

.preview-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: CanvasText;
}

.trade-preview-card {
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
}

.preview-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease-out;
}

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

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
}

.modal-small {
    max-width: 400px;
}

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

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: CanvasText;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-item);
    border: none;
    color: CanvasText;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close:hover {
    background: var(--bg-item-hover);
}

.modal-body {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.option-group {
    display: flex;
    gap: 0.75rem;
}

.option-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-item);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: CanvasText;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-btn:hover {
    background: var(--bg-item-hover);
    border-color: #667eea;
}

.option-btn.active {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    color: #667eea;
}

.hidden {
    display: none !important;
}

/* ========== TABLET & DESKTOP ========== */
@media (min-width: 768px) {
    .trading-container {
        padding: 1.5rem;
    }

    .browse-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .btn-create-trade {
        width: auto;
        min-width: 180px;
    }

    .browse-filters {
        flex-direction: row;
        align-items: center;
    }

    .search-box {
        flex: 1;
    }

    .filter-row {
        flex-wrap: nowrap;
    }

    .filter-select {
        min-width: 140px;
    }

    .trades-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .wizard-progress {
        padding: 0 2rem;
    }

    .step-3-content {
        flex-direction: row;
        gap: 2rem;
    }

    .details-column {
        flex: 1;
    }

    .preview-column {
        display: block;
        flex: 0 0 320px;
    }

    .theme-selector {
        grid-template-columns: repeat(4, 1fr);
    }

    .step-actions {
        position: relative;
        margin: 0;
        padding-left: 0;
        padding-right: 0;
    }
}

@media (min-width: 1024px) {
    .trades-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .wizard-container {
        max-width: 1000px;
    }

    .step-3-content {
        gap: 3rem;
    }

    .preview-column {
        flex: 0 0 380px;
    }
}
