/* SNS Auto-Poster Custom Styles */

* { box-sizing: border-box; }

:root {
    --sidebar-w: 260px;
    --primary: #6366f1;
    --primary-light: #e0e7ff;
    --primary-dark: #4338ca;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    margin: 0;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* Sidebar */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: white;
    border-right: 1px solid var(--gray-200);
    display: flex; flex-direction: column;
    z-index: 40;
    transition: transform 0.3s;
}

.sidebar-logo {
    padding: 24px 20px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.sidebar-logo h1 {
    font-size: 20px; font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin: 0;
}

.sidebar-logo p {
    font-size: 11px; color: var(--gray-400); margin: 4px 0 0;
}

.brand-selector {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.brand-selector select {
    width: 100%; padding: 8px 12px;
    border: 1px solid var(--gray-200); border-radius: 8px;
    font-size: 13px; background: var(--gray-50);
    outline: none; cursor: pointer;
}

.brand-selector select:focus { border-color: var(--primary); }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 10px; font-weight: 700; color: var(--gray-400);
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 8px 12px 4px; margin: 0;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    font-size: 13.5px; font-weight: 500;
    color: var(--gray-600); cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.nav-item:hover { background: var(--gray-50); color: var(--gray-800); }
.nav-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px; border-top: 1px solid var(--gray-100);
    font-size: 11px; color: var(--gray-400);
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

.page-header {
    padding: 24px 32px 0;
}

.page-header h2 {
    font-size: 22px; font-weight: 700; margin: 0 0 4px; color: var(--gray-900);
}

.page-header p {
    font-size: 13px; color: var(--gray-500); margin: 0;
}

.page-body {
    padding: 20px 32px 32px;
}

/* Cards */
.card {
    background: white; border-radius: 12px;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 15px; font-weight: 600; margin: 0;
}

.card-body { padding: 20px; }

/* Stat cards */
.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 24px;
}

.stat-card {
    background: white; border-radius: 12px;
    border: 1px solid var(--gray-200);
    padding: 20px;
}

.stat-card .stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; margin: 4px 0; color: var(--gray-900); }
.stat-card .stat-sub { font-size: 12px; color: var(--gray-400); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    font-size: 13px; font-weight: 500;
    cursor: pointer; border: none;
    transition: all 0.15s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-outline { background: white; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Form elements */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }

.form-input, .form-textarea, .form-select {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--gray-200); border-radius: 8px;
    font-size: 13px; color: var(--gray-800);
    outline: none; transition: border-color 0.15s;
    background: white;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

/* Media grid */
.media-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.media-item {
    position: relative; aspect-ratio: 1;
    border-radius: 8px; overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer; transition: all 0.2s;
    background: var(--gray-100);
}

.media-item:hover { border-color: var(--gray-300); transform: scale(1.02); }
.media-item.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); }

.media-item img {
    width: 100%; height: 100%; object-fit: cover;
}

.media-item .media-check {
    position: absolute; top: 6px; right: 6px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--primary); color: white;
    display: none; align-items: center; justify-content: center;
    font-size: 12px;
}

.media-item.selected .media-check { display: flex; }

.media-item .media-badge {
    position: absolute; bottom: 6px; left: 6px;
    background: rgba(0,0,0,0.6); color: white;
    padding: 2px 8px; border-radius: 4px;
    font-size: 10px; font-weight: 500;
}

.media-item .media-delete {
    position: absolute; top: 6px; left: 6px;
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(239, 68, 68, 0.9); color: white;
    display: none; align-items: center; justify-content: center;
    font-size: 14px; cursor: pointer; border: none;
}

.media-item:hover .media-delete { display: flex; }

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--gray-300); border-radius: 12px;
    padding: 40px 20px; text-align: center;
    cursor: pointer; transition: all 0.15s;
    background: var(--gray-50);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary); background: var(--primary-light);
}

.upload-zone svg { width: 40px; height: 40px; color: var(--gray-400); margin-bottom: 8px; }
.upload-zone p { color: var(--gray-500); font-size: 13px; margin: 0; }

/* Platform previews */
.preview-tabs {
    display: flex; gap: 4px; margin-bottom: 16px;
}

.preview-tab {
    padding: 6px 14px; border-radius: 6px;
    font-size: 12px; font-weight: 500;
    cursor: pointer; border: none;
    background: var(--gray-100); color: var(--gray-600);
    transition: all 0.15s;
}

.preview-tab.active { background: var(--primary); color: white; }

.preview-phone {
    width: 320px; margin: 0 auto;
    border: 2px solid var(--gray-200); border-radius: 24px;
    overflow: hidden; background: white;
}

.preview-phone-header {
    padding: 12px 14px;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--gray-100);
}

.preview-phone-header .profile-pic {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 12px; font-weight: 700;
}

.preview-phone-header .profile-name { font-size: 13px; font-weight: 600; }
.preview-phone-header .profile-sub { font-size: 10px; color: var(--gray-400); }

.preview-phone-image {
    aspect-ratio: 1; background: var(--gray-100);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}

.preview-phone-image img { width: 100%; height: 100%; object-fit: cover; }
.preview-phone-image .empty-text { color: var(--gray-400); font-size: 13px; }

.preview-phone-actions {
    padding: 10px 14px;
    display: flex; gap: 14px; align-items: center;
}

.preview-phone-actions svg { width: 22px; height: 22px; color: var(--gray-700); cursor: pointer; }
.preview-phone-actions .spacer { flex: 1; }

.preview-phone-caption {
    padding: 0 14px 14px;
    font-size: 12px; line-height: 1.6;
    color: var(--gray-700);
    max-height: 120px; overflow-y: auto;
}

.preview-phone-caption .caption-name { font-weight: 700; color: var(--gray-900); }
.preview-phone-caption .caption-hashtags { color: #1d4ed8; }

/* Progress bar */
.progress-bar {
    height: 4px; background: var(--gray-200); border-radius: 2px; overflow: hidden;
}

.progress-bar-fill {
    height: 100%; background: var(--primary);
    border-radius: 2px; transition: width 0.3s;
}

/* Modal */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.show { opacity: 1; pointer-events: auto; }

.modal {
    background: white; border-radius: 16px;
    width: 90%; max-width: 560px; max-height: 85vh;
    overflow-y: auto; transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.show .modal { transform: scale(1); }

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

.modal-header h3 { font-size: 17px; font-weight: 700; margin: 0; }

.modal-close {
    width: 32px; height: 32px; border-radius: 8px;
    border: none; background: var(--gray-100);
    cursor: pointer; font-size: 18px; color: var(--gray-500);
    display: flex; align-items: center; justify-content: center;
}

.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex; gap: 8px; justify-content: flex-end;
}

/* Toast */
.toast-container {
    position: fixed; top: 20px; right: 20px;
    z-index: 200; display: flex; flex-direction: column; gap: 8px;
}

.toast {
    padding: 12px 20px; border-radius: 10px;
    font-size: 13px; font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--primary); color: white; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Platform chips */
.platform-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
}

.platform-chip.instagram { background: #fce7f3; color: #db2777; }
.platform-chip.facebook { background: #dbeafe; color: #2563eb; }
.platform-chip.xiaohongshu { background: #fee2e2; color: #dc2626; }

/* Content creator layout */
.creator-layout {
    display: grid; grid-template-columns: 1fr 360px;
    gap: 24px; align-items: start;
}

.creator-left { display: flex; flex-direction: column; gap: 20px; }

/* Calendar */
.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 1px; background: var(--gray-200); border-radius: 8px; overflow: hidden;
}

.calendar-cell {
    background: white; padding: 8px; min-height: 100px;
    font-size: 12px;
}

.calendar-cell.today { background: var(--primary-light); }
.calendar-cell.other-month { background: var(--gray-50); color: var(--gray-400); }

.calendar-cell .cal-day { font-weight: 600; margin-bottom: 4px; }
.calendar-cell .cal-dot {
    width: 6px; height: 6px; border-radius: 50%;
    display: inline-block; margin: 1px;
}

.cal-dot.instagram { background: #db2777; }
.cal-dot.facebook { background: #2563eb; }
.cal-dot.xiaohongshu { background: #dc2626; }

/* Checkbox / Toggle */
.platform-toggle {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border: 1px solid var(--gray-200);
    border-radius: 8px; cursor: pointer;
    transition: all 0.15s;
}

.platform-toggle:hover { border-color: var(--gray-300); }
.platform-toggle.active { border-color: var(--primary); background: var(--primary-light); }
.platform-toggle input { display: none; }
.platform-toggle .toggle-icon { width: 24px; height: 24px; }
.platform-toggle .toggle-name { font-size: 13px; font-weight: 500; }

/* Tab nav */
.tab-nav { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }
.tab-item {
    padding: 10px 20px; font-size: 13px; font-weight: 500;
    color: var(--gray-500); cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all 0.15s;
}
.tab-item:hover { color: var(--gray-700); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Loading spinner */
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
    text-align: center; padding: 60px 20px;
}

.empty-state svg { width: 64px; height: 64px; color: var(--gray-300); margin-bottom: 16px; }
.empty-state h4 { font-size: 16px; color: var(--gray-600); margin: 0 0 8px; }
.empty-state p { font-size: 13px; color: var(--gray-400); margin: 0 0 20px; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .creator-layout { grid-template-columns: 1fr; }
}
