:root {
    --bg-dark: #0f172a;
    --bg-gradient: radial-gradient(circle at 0% 0%, #1e1b4b 0%, #0f172a 50%, #020617 100%);
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(148, 163, 184, 0.2);
    
    /* Social Colors */
    --fb-color: #1877F2;
    --ig-color: #E1306C; /* approximate base, will use gradient */
    --ig-gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    --tt-color: #00f2ea; /* TikTok Cyan for distinction */
    --tt-red: #ff0050;
    --yt-color: #FF0000;
    --wa-color: #25D366;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

/* Enhanced Dynamic Backdrop (Mesh Gradient) */
body {
    background: #020617;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    overflow-x: hidden;
    position: relative;
}

.mesh-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background-color: #020617;
}

.mesh-ball {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: meshFlow 20s infinite alternate-reverse ease-in-out;
}

.ball-1 { background: #6366f1; top: -200px; left: -100px; animation-duration: 25s; }
.ball-2 { background: #ec4899; bottom: -200px; right: -100px; animation-duration: 30s; animation-delay: -5s; }
.ball-3 { background: #3b82f6; top: 40%; left: 60%; animation-duration: 22s; animation-delay: -12s; }

@keyframes meshFlow {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(100px, 50px) scale(1.2); }
    66% { transform: translate(-50px, 150px) scale(0.9); }
    100% { transform: translate(50px, -50px) scale(1.1); }
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Layout */
.app-container {
    width: 100%;
    max-width: 1200px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--glass-shadow);
}

.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}
.logo i {
    color: var(--primary);
    filter: drop-shadow(0 0 10px var(--primary-glow));
}
.logo span {
    background: linear-gradient(to right, #6366f1, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.subtitle {
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-size: 1.1rem;
}

.main-content {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 3rem;
}

/* Form Styles */
.input-group {
    margin-bottom: 1.5rem;
}
.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}
.required {
    color: #ef4444;
}

/* File Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: rgba(15, 23, 42, 0.4);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}
.drop-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}
.drop-zone:hover .drop-icon {
    transform: translateY(-5px);
}
.drop-zone p {
    color: var(--text-main);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}
.drop-zone p span {
    color: var(--primary);
    text-decoration: underline;
}
.drop-zone small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Input Fields */
textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-main);
    font-size: 1rem;
    resize: vertical;
    transition: var(--transition);
}
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Platform Grid */
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 1rem;
}
.platform-checkbox {
    display: none;
}
.platform-card {
    cursor: pointer;
}
.platform-inner {
    border: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
    padding: 1.25rem 0.5rem;
    text-align: center;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

/* Status Dot Indicator */
.platform-status {
    position: absolute;
    top: 6px;
    left: 10px; /* Moved from right to left for better balance */
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    color: var(--text-muted);
}
.status-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
}
.status-dot.active {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

/* Emoji Picker UI */
.caption-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}
.emoji-picker-mini {
    display: flex;
    gap: 10px;
    padding: 8px;
    background: rgba(15, 23, 42, 0.6);
    border-top: 1px solid var(--border-color);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}
.emoji-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    padding: 0;
    width: auto;
    flex: none;
    cursor: pointer;
    transition: transform 0.2s;
}
.emoji-btn:hover { transform: scale(1.3); }

textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-bottom: none; /* merge with emoji picker */
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 1rem;
    color: var(--text-main);
    font-size: 1rem;
    resize: vertical;
    transition: var(--transition);
}
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Checkbox Checked States */
.platform-checkbox:checked + .platform-inner.platform-fb {
    border-color: var(--fb-color);
    background: rgba(24, 119, 242, 0.1);
    box-shadow: 0 4px 15px rgba(24, 119, 242, 0.2);
}
.platform-checkbox:checked + .platform-inner.platform-fb i,
.platform-checkbox:checked + .platform-inner.platform-fb span { color: var(--fb-color); }

.platform-checkbox:checked + .platform-inner.platform-ig {
    border-color: #E1306C;
    background: rgba(225, 48, 108, 0.1);
    box-shadow: 0 4px 15px rgba(225, 48, 108, 0.2);
}
.platform-checkbox:checked + .platform-inner.platform-ig i {
    background: var(--ig-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.platform-checkbox:checked + .platform-inner.platform-ig span { color: #E1306C; }

.platform-checkbox:checked + .platform-inner.platform-tt {
    border-color: var(--tt-color);
    background: rgba(0, 242, 234, 0.08);
    box-shadow: 0 4px 15px rgba(0, 242, 224, 0.3);
}
.platform-checkbox:checked + .platform-inner.platform-tt i,
.platform-checkbox:checked + .platform-inner.platform-tt span { 
    color: var(--tt-color); 
    text-shadow: none;
}

.platform-checkbox:checked + .platform-inner.platform-yt {
    border-color: var(--yt-color);
    background: rgba(255, 0, 0, 0.1);
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.2);
}
.platform-checkbox:checked + .platform-inner.platform-yt i,
.platform-checkbox:checked + .platform-inner.platform-yt span { color: var(--yt-color); }

/* Buttons */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}
button {
    flex: 1;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}
.btn-primary:active { transform: translateY(0); }

.btn-whatsapp {
    background: transparent;
    border: 1px solid var(--wa-color);
    color: var(--wa-color);
    flex: 0.5;
}
.btn-whatsapp:hover {
    background: rgba(37, 211, 102, 0.1);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.2);
}

/* Preview Section */
.preview-section {
    display: flex;
    flex-direction: column;
}
.preview-header {
    margin-bottom: 1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Advanced Settings Cards */
.advanced-settings-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}
.section-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.form-group input[type="text"] {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition);
}
.form-group input[type="text"]:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Custom File Input & Thumbnail Preview */
.custom-file-input {
    width: 100%;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.thumbnail-preview-box {
    margin-top: 1rem;
    width: 160px;
    height: 90px; /* 16:9 ratio for YT */
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.thumbnail-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Switch Toggle */
.schedule-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
}
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
}
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* Datetime Input */
.datetime-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 0.95rem;
    color-scheme: dark;
}

/* Hole-punch Camera */
.device-notch {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: #000;
    border-radius: 50%;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 0 4px rgba(255, 255, 255, 0.1);
}

.preview-body {
    height: 100%;
    background: #0f172a;
    border-radius: 38px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;
}
.preview-body::-webkit-scrollbar { display: none; }

.preview-user {
    display: flex;
    align-items: center;
    padding: 1rem 1rem 0.5rem 1rem;
    gap: 0.75rem;
    margin-top: 0.75rem; /* reduced spacing for a tighter look */
}
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}
.user-info {
    display: flex;
    flex-direction: column;
}
.username {
    font-size: 0.85rem;
    font-weight: 600;
}
.time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Skeleton Loading Area */
.skeleton {
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        rgba(30, 41, 59, 0.4) 25%, 
        rgba(51, 65, 85, 0.4) 50%, 
        rgba(30, 41, 59, 0.4) 75%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
}

@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.preview-media {
    width: 100%;
    min-height: 200px;
    max-height: 480px; 
    height: auto;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.empty-state {
    text-align: center;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}
.empty-state p {
    font-size: 0.85rem;
}

.preview-actions {
    padding: 0.75rem 1rem;
    display: flex;
    gap: 1rem;
    font-size: 1.25rem;
}
.preview-caption {
    padding: 1rem;
    font-size: 0.85rem;
    line-height: 1.4;
    word-break: break-word;
}
.preview-caption p {
    white-space: pre-wrap;
}

/* Responsive */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    .device-mockup {
        height: 500px;
    }
    .form-actions {
        flex-direction: column;
    }
}
@media (max-width: 480px) {
    .app-container {
        padding: 1.5rem;
    }
    .logo h1 { font-size: 1.5rem; }
}
