﻿/* Dark Mode Theme */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-color: #667eea;
    --accent-hover: #5568d3;
    --border-color: #333333;
    --text-muted: #a8a8a8;
}

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

/* Open Sheet Button - Floating */
.open-sheet-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    background: var(--accent-color);
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999;
}

.open-sheet-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

/* Bottom Sheet Overlay */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    z-index: 10000;
}

.bottom-sheet-overlay.active {
    display: block;
}

/* Bottom Sheet */
.bottom-sheet {
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 900px;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.5);
    transition: bottom 0.3s ease;
    z-index: 10001;
    max-height: 90vh;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.bottom-sheet.active {
    bottom: 0;
}

/* Sheet Header */
.sheet-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(37, 37, 37, 0.8);
    backdrop-filter: blur(10px);
}

.sheet-header h4 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Sheet Body */
.sheet-body {
    display: flex;
    flex-direction: column;
    height: calc(90vh - 61px);
    overflow-y: auto;
}

/* Post Type Tabs */
.post-tabs {
    display: flex;
    gap: 0;
    background: rgba(15, 15, 15, 0.5);
    padding: 0;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.tab-btn:hover {
    background: rgba(37, 37, 37, 0.5);
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-color);
    background: rgba(102, 126, 234, 0.1);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-color);
}

/* Input Section */
.input-section {
    padding: 20px;
    background: rgba(26, 26, 26, 0.8);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 10;
}

.form-label {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    display: block;
    user-select: none;
    pointer-events: none;
}

/* Post Content Containers */
.post-content {
    animation: fadeIn 0.3s ease;
}

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

/* Style Selector */
.style-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.style-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
    font-weight: 500;
}

.style-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
}

.style-btn.selected {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: white;
}

/* Background Selector */
.bg-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.bg-option {
    aspect-ratio: 16/8;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 10px;
}

.bg-option:hover {
    border-color: var(--accent-color);
    transform: scale(1.05);
}

.bg-option.selected {
    border-color: var(--accent-color);
    border-width: 3px;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.4);
}

.bg-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Textarea Container */
.textarea-container {
    position: relative;
    z-index: 20;
}

/* Editable Div styled as textarea */
.editable-div {
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.editable-div:empty:before {
    content: attr(data-placeholder);
    color: var(--text-secondary);
    pointer-events: none;
}

.editable-div:focus:before {
    content: '';
}

.form-control {
    width: 100%;
    padding: 12px;
    padding-right: 80px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    font-size: 14px;
    resize: vertical;
    transition: all 0.3s;
    position: relative;
    z-index: 20;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
}

.form-control:focus {
    outline: none !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    z-index: 10002;
    background: var(--bg-tertiary) !important;
}

/* Ensure editable div is always interactive */
.editable-div {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    pointer-events: auto !important;
    cursor: text !important;
}

.editable-div:focus {
    outline: none !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

/* Character Counter */
.char-counter {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 5px;
    text-align: right;
}

.char-counter.warning {
    color: #ff9800;
}

.char-counter.danger {
    color: #f44336;
}

/* Post Button */
.post-btn {
    position: absolute;
    bottom: 0;
    right: 12px;
    padding: 8px 20px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.post-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

/* Preview Section */
.preview-section {
    padding: 20px;
    background: rgba(15, 15, 15, 0.5);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.preview-label {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 15px;
}

.preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.preview-area {
    background: rgba(37, 37, 37, 0.6);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    padding: 10px;
}

/* Different preview sizes based on store style */
.preview-area.vertical {
    width: 200px;
    aspect-ratio: 9/16;
}

.preview-area.wide {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 16/9;
}

.preview-placeholder {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Media Preview Container */
.media-preview-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.media-preview {
    max-width: 400px;
    border-radius: 10px;
    overflow: hidden;
}

.media-preview img,
.media-preview video {
    width: 100%;
    display: block;
    border-radius: 10px;
}

.text-overlay-preview {
    background: rgba(37, 37, 37, 0.6);
    border-radius: 10px;
    padding: 10px;
    border: 1px solid var(--border-color);
}

.text-overlay-preview img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Scrollbar Styling */
.sheet-body::-webkit-scrollbar {
    width: 8px;
}

.sheet-body::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.sheet-body::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.sheet-body::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Loading Spinner */
.spinner-border {
    color: var(--accent-color);
}

/* Responsive */
@media (max-width: 768px) {
    .bottom-sheet {
        width: 100%;
        border-radius: 20px 20px 0 0;
    }

    .bg-selector {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }

    .preview-area.vertical {
        width: 150px;
    }

    .preview-area.wide {
        width: 250px;
    }

    .media-preview {
        max-width: 100%;
    }
}

/* Emoji */
.emoji-picker-container{
    position: absolute;
}

.emoji-btn{
    background: var(--bg-secondary);
    border: none;
    border-radius: 0;
    padding: 10px;
    cursor: pointer;
}

.post-content .mb-3 .text-muted {
    color: var(--text-muted);
}

.post-btn .spinner-border {
    max-width: 15px;
    max-height: 15px;
}
