/* ==========================================
   VIDR - TIKTOK-STYLE CREATE POST
   ========================================== */

.tiktok-create-modal {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

/* Selection Screen */
.create-selection-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.create-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(12px + var(--safe-top));
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
}

.create-header h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
}

.create-header .back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
}

.create-options-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
    overflow-y: auto;
    align-content: start;
}

.create-option-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-lg);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-card);
}

.create-option-card:active {
    transform: scale(0.97);
}

.create-option-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.option-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    margin: 0 auto 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.option-title {
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.option-desc {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    line-height: 1.3;
}

/* Preview Screen - TikTok Style */
.create-preview-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(12px + var(--safe-top));
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.preview-header h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: white;
}

.preview-header .back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.preview-header .primary-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: var(--border-radius-full);
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    font-family: var(--font-primary);
}

.preview-header .primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Preview Media Area */
.preview-media-area {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
    min-height: 60vh;
}

.preview-media-area img,
.preview-media-area video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.preview-media-area.text-mode {
    background: linear-gradient(135deg, #f8a4d0, #a8d8ea, #d5aaff);
    padding: 40px 24px;
}

.preview-media-area.text-mode textarea {
    width: 100%;
    max-width: 400px;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    resize: none;
    font-family: var(--font-primary);
    line-height: 1.4;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    min-height: 200px;
}

.preview-media-area.text-mode textarea::placeholder {
    color: rgba(255,255,255,0.7);
}

/* Multi-image preview */
.preview-media-area.multi-image {
    padding: 20px;
}

.multi-image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    max-width: 400px;
    width: 100%;
}

.multi-image-grid .preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,0.1);
}

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

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

.multi-image-grid .add-more {
    aspect-ratio: 1;
    border: 2px dashed rgba(255,255,255,0.4);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255,255,255,0.7);
    font-size: 1.5rem;
    background: rgba(255,255,255,0.05);
}

/* Media placeholder (no media yet) */
.media-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: white;
}

.media-placeholder .placeholder-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 2rem;
}

.media-placeholder button {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: var(--border-radius-full);
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-primary);
    margin-top: 12px;
}

/* Editor Panel */
.preview-editor-panel {
    background: var(--bg-card);
    padding: 12px 16px;
    padding-bottom: calc(12px + var(--safe-bottom));
    border-top: 1px solid var(--border-light);
    max-height: 40vh;
    overflow-y: auto;
}

.preview-editor-panel textarea {
    width: 100%;
    background: none;
    border: none;
    outline: none;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    resize: none;
    min-height: 60px;
    max-height: 150px;
    line-height: 1.5;
}

.editor-char-count {
    text-align: right;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.editor-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid var(--border-light);
    padding-top: 8px;
    margin-bottom: 12px;
}

.editor-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
}

.editor-option:last-child {
    border-bottom: none;
}

.editor-option i:first-child {
    font-size: 1.2rem;
    color: var(--primary);
    width: 24px;
    text-align: center;
}

.editor-option span {
    flex: 1;
    color: var(--text-secondary);
}

.editor-option .boost-badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 3px 10px;
    border-radius: var(--border-radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    flex: 0;
}

.editor-option.active .boost-badge {
    background: var(--success-dark);
    color: white;
}

/* Privacy Options */
.privacy-options {
    display: flex;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}

.privacy-btn {
    flex: 1;
    padding: 8px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.privacy-btn.active {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary);
}

.privacy-btn i {
    font-size: 0.9rem;
}

/* Sell Form */
.create-sell-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow-y: auto;
}

.create-sell-form .preview-header {
    position: relative;
    background: var(--bg-primary);
    backdrop-filter: none;
    border-bottom: 1px solid var(--border-light);
}

.create-sell-form .preview-header .back-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.create-sell-form .preview-header h2 {
    color: var(--text-primary);
}

.sell-form-content {
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
}

.sell-images-section h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.sell-images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.add-photo-tile {
    aspect-ratio: 1;
    border: 2px dashed var(--border-medium);
    border-radius: var(--border-radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary);
    font-size: 1.5rem;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.add-photo-tile:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.add-photo-tile span {
    font-size: 0.7rem;
    margin-top: 4px;
    color: var(--text-secondary);
}

.sell-images-grid .preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    background: var(--bg-secondary);
}

.sell-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-light);
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-primary);
    margin-bottom: 10px;
    transition: border 0.2s;
}

.sell-input:focus {
    border-color: var(--primary);
}

.sell-textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-light);
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-primary);
    margin-bottom: 10px;
    resize: none;
    min-height: 80px;
}

.sell-textarea:focus {
    border-color: var(--primary);
}

.sell-select {
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-light);
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-primary);
    cursor: pointer;
}

.price-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.price-row .sell-select {
    width: 110px;
    margin: 0;
}

.affiliate-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    margin-top: 8px;
}

/* Camera Mode */
.camera-mode {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.camera-preview-video {
    flex: 1;
    width: 100%;
    object-fit: cover;
}

.camera-controls {
    padding: 20px;
    padding-bottom: calc(20px + var(--safe-bottom));
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.camera-shutter {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 5px solid white;
    background: #ff3040;
    cursor: pointer;
}

.camera-shutter.recording {
    background: white;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    border-color: #ff3040;
}

.camera-flip {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Uploading state */
.upload-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 20px 30px;
    border-radius: var(--border-radius-lg);
    text-align: center;
    z-index: 100;
}

.upload-progress .progress-bar {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
}

.upload-progress .progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}
