/* ===== CSS Variables ===== */
:root {
    --primary: #1f2937;
    --secondary: #374151;
    --accent: #3b82f6;
    --accent-light: #dbeafe;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* ===== Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
}

body {
    display: flex;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: var(--primary);
    color: white;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.sidebar-header {
    text-align: center;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.tagline {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background-color: var(--accent);
    color: white;
}

.nav-item .icon {
    font-size: 18px;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== Main Content ===== */
.content {
    margin-left: 260px;
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    max-height: 100vh;
}

/* ===== Page Sections ===== */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

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

.stat-card {
    background: var(--bg-white);
    padding: 24px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
    border-left: 4px solid var(--accent);
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Grid Layout ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-white);
    padding: 24px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* ===== Post List ===== */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.post-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: 4px;
}

.post-item:last-child {
    border-bottom: none;
}

.post-item:hover {
    background: var(--bg-light);
}

.post-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.post-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== Session List ===== */
.session-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.session-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    border-radius: 4px;
}

.session-item:last-child {
    border-bottom: none;
}

.session-time {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.session-info {
    font-size: 12px;
    color: var(--text-secondary);
}

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

.post-card {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
}

.post-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

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

.badge {
    background: var(--accent-light);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.post-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.post-actions {
    display: flex;
    gap: 8px;
}

/* ===== Groups List ===== */
.groups-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.group-card {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--accent);
}

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

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

.priority-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-badge.high {
    background: #fee2e2;
    color: #991b1b;
}

.priority-badge.medium {
    background: #fef08a;
    color: #92400e;
}

.priority-badge.low {
    background: #dbeafe;
    color: #0c4a6e;
}

.group-url {
    font-size: 13px;
    color: var(--accent);
    word-break: break-all;
    margin-bottom: 8px;
}

.group-niche {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.group-members {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.group-actions {
    display: flex;
    gap: 8px;
}

/* ===== Sessions List ===== */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.session-card {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
}

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

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

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.scheduled {
    background: #dbeafe;
    color: #0c4a6e;
}

.status-badge.completed {
    background: #dcfce7;
    color: #15803d;
}

.session-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.session-details p {
    font-size: 13px;
    color: var(--text-secondary);
}

.session-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* ===== Publishing Panel ===== */
.publishing-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.session-selector {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.session-selector h2 {
    font-size: 16px;
    font-weight: 600;
}

.publisher-panel {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.publisher-panel.hidden {
    display: none;
}

.group-info {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.group-info h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.group-members {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== Post Preview ===== */
.post-preview {
    margin-bottom: 24px;
}

.post-preview h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.preview-box {
    background: var(--bg-light);
    padding: 16px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.preview-box p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.preview-box p:last-child {
    margin-bottom: 0;
}

.preview-link {
    color: var(--accent);
    font-weight: 500;
}

/* ===== Publishing Actions ===== */
.post-actions-publishing {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.timer {
    text-align: center;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 6px;
    margin-bottom: 16px;
}

.timer p {
    font-size: 14px;
    color: var(--text-secondary);
}

.timer strong {
    font-size: 20px;
    color: var(--accent);
    font-weight: 600;
}

/* ===== Progress Bar ===== */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

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

/* ===== Buttons ===== */
.btn-primary, .btn-secondary, .btn-danger, .btn-success, .btn-small {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
}

.btn-danger:hover {
    background: #fecaca;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
}

.btn-small:hover {
    background: var(--bg-light);
    border-color: var(--text-secondary);
}

/* ===== Forms ===== */
.form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.form-input, .form-textarea, .form-select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    font-family: inherit;
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* ===== Modals ===== */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-white);
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    cursor: pointer;
}

.modal-overlay.hidden {
    display: none;
}

/* ===== Utilities ===== */
.hidden {
    display: none !important;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
        padding: 12px;
    }

    .sidebar-header {
        margin-bottom: 20px;
    }

    .logo {
        font-size: 24px;
    }

    .tagline {
        display: none;
    }

    .nav-item span:last-child {
        display: none;
    }

    .nav-item {
        justify-content: center;
    }

    .content {
        margin-left: 70px;
        padding: 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .publishing-container {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .groups-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sidebar {
        position: absolute;
        width: 100%;
        height: auto;
    }

    .content {
        margin-left: 0;
        padding-top: 80px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .post-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .post-actions {
        flex-wrap: wrap;
    }

    .modal {
        max-width: 95%;
        padding: 20px;
    }
}
