:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(18, 26, 44, 0.75);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    --bg-card-hover: rgba(26, 38, 64, 0.85);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.35);
    
    --accent-facebook: #1877f2;
    --accent-instagram: #e1306c;
    --gradient-ig: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    
    --status-scheduled: #fbbf24;
    --status-published: #10b981;
    --status-failed: #ef4444;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(12, 17, 29, 0.95);
    border-right: 1px solid var(--bg-card-border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--bg-card-border);
}

.brand-icon {
    font-size: 28px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--primary-glow);
}

.brand-text h2 {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.brand-text span {
    font-size: 12px;
    color: var(--text-muted);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 24px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.system-status-box {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--status-published);
    box-shadow: 0 0 10px var(--status-published);
}

.status-details {
    display: flex;
    flex-direction: column;
}

.status-title {
    font-size: 13px;
    font-weight: 600;
}

.status-sub {
    font-size: 11px;
    color: var(--text-dim);
}

/* Main Content */
.content-area {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
}

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

.header-title h1 {
    font-size: 26px;
    font-weight: 700;
}

.header-title p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

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

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border: 1px solid var(--bg-card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-facebook {
    background: var(--accent-facebook);
    color: #ffffff;
}

.btn-facebook:hover {
    background: #166fe5;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.4);
}

/* Tabs Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    font-size: 26px;
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

.max-w-600 {
    max-width: 600px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--bg-card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.filter-group {
    display: flex;
    gap: 6px;
}

.filter-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
}

.filter-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: var(--bg-card-border);
}

/* Posts List */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    gap: 20px;
    transition: var(--transition);
}

.post-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.post-media-preview {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: rgba(0, 0, 0, 0.3);
}

.post-media-placeholder {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.post-content-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.post-caption {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.post-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.post-targets-list {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.target-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
}

.target-badge.published {
    border: 1px solid var(--status-published);
    color: var(--status-published);
}

.target-badge.failed {
    border: 1px solid var(--status-failed);
    color: var(--status-failed);
}

.target-badge.pending {
    border: 1px solid var(--status-scheduled);
    color: var(--status-scheduled);
}

.badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
}

/* Accounts Grid */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.account-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

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

.account-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.account-name {
    font-size: 14px;
    font-weight: 600;
}

.account-platform {
    font-size: 11px;
    font-weight: 500;
    margin-top: 2px;
}

.platform-fb {
    color: var(--accent-facebook);
}

.platform-ig {
    color: #f472b6;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
textarea {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

input:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Dropzone */
.media-upload-dropzone {
    border: 2px dashed var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(0, 0, 0, 0.2);
}

.media-upload-dropzone:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.dropzone-icon {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
}

.dropzone-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 580px;
    background: var(--bg-dark);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--bg-card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
    max-height: 75vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.accounts-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 160px;
    overflow-y: auto;
}

.account-select-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-dim);
    font-size: 14px;
}

.info-note {
    margin-top: 20px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    font-size: 12px;
}

.info-note code {
    display: block;
    margin-top: 6px;
    color: var(--primary);
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.alert-banner {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-size: 14px;
}

.alert-banner.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--status-published);
    color: #6ee7b7;
}

.alert-banner.info {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--primary);
    color: #a5b4fc;
}

.bm-badge {
    font-size: 11px;
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
    margin-top: 4px;
}

select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
}

select option {
    background: var(--bg-dark);
    color: #ffffff;
}

.code-output {
    width: 100%;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.5);
    color: #a7f3d0;
    line-height: 1.5;
    resize: none;
}

.instruction-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.instruction-box h4 {
    font-size: 14px;
    color: var(--primary);
    margin-top: 8px;
}

.instruction-box pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--bg-card-border);
    overflow-x: auto;
    font-size: 12px;
    color: #93c5fd;
}

.sync-status-box {
    margin-top: 16px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    font-size: 13px;
}

.row-inline {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-main);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.hidden {
    display: none !important;
}
