/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #121212;
    --secondary: #1e1e1e;
    --tertiary: #252525;
    --accent: #4a90e2;
    --accent-hover: #3a7bc8;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    --success: #4CAF50;
    --error: #f44336;
    --warning: #ff9800;
    --border: #2d2d2d;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    background: var(--secondary);
    padding: 15px 20px;
    border-bottom: 2px solid var(--accent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-title {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--accent);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
}

.status-dot.connected {
    background: var(--success);
}

.status-dot.disconnected {
    background: var(--error);
}

/* Tabs */
.tabs-container {
    background: var(--secondary);
    padding: 10px 20px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    white-space: nowrap;
    position: sticky;
    top: 60px;
    z-index: 999;
}

.tab {
    padding: 8px 16px;
    background: var(--tertiary);
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.tab:hover {
    background: var(--border);
    border-color: var(--text-secondary);
}

.tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.add-tab {
    background: transparent;
    border: 1px dashed var(--text-tertiary);
    color: var(--text-tertiary);
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.add-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Main Container */
.container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    padding: 20px;
    min-height: calc(100vh - 130px);
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }
}

/* Sidebar */
.sidebar {
    background: var(--secondary);
    border-radius: 8px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 140px;
}

.sidebar-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.sidebar-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-title::before {
    content: "📌";
    font-size: 14px;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 20px;
}

.section {
    background: var(--secondary);
    border-radius: 8px;
    padding: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

input, textarea, select {
    width: 100%;
    padding: 10px 12px;
    background: var(--tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23ffffff' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #3d8b40;
}

.btn-error {
    background: var(--error);
}

.btn-error:hover {
    background: #d32f2f;
}

.btn-warning {
    background: var(--warning);
}

.btn-warning:hover {
    background: #f57c00;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Checkboxes and Radio buttons */
.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    cursor: pointer;
}

.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.checkbox label {
    margin-bottom: 0;
    cursor: pointer;
}

/* Status Indicators */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--tertiary);
    border-radius: 4px;
    margin: 15px 0;
    border-left: 4px solid var(--accent);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.connected {
    background: var(--success);
}

.status-dot.disconnected {
    background: var(--error);
}

.status-dot.scheduling {
    background: var(--warning);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Files Grid */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.file-card {
    background: var(--tertiary);
    border-radius: 6px;
    padding: 15px;
    border: 1px solid var(--border);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.file-icon {
    font-size: 24px;
    color: var(--accent);
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    margin-bottom: 4px;
    word-break: break-word;
}

.file-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.file-stats {
    text-align: right;
}

/* Posts List */
.posts-list {
    margin-top: 15px;
}

.post-item {
    background: var(--tertiary);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid var(--accent);
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.post-time {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 60px;
}

.post-text {
    flex: 1;
    word-break: break-word;
}

.post-actions {
    display: flex;
    gap: 8px;
}

.btn-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--secondary);
}

.btn-link:hover {
    background: var(--border);
}

/* Log Content */
.log-content {
    background: var(--primary);
    border-radius: 4px;
    padding: 15px;
    height: 300px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 15px;
    border: 1px solid var(--border);
}

.log-entry {
    margin-bottom: 6px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-info {
    color: var(--text-primary);
}

.log-success {
    color: var(--success);
}

.log-error {
    color: var(--error);
}

.log-warning {
    color: var(--warning);
}

.post-preview {
    background: var(--secondary);
    padding: 8px;
    margin-top: 4px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent);
}

/* Empty States */
.empty-state-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    text-align: center;
}

.empty-state-content {
    max-width: 400px;
}

.empty-state {
    background: var(--tertiary);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
    border: 2px dashed var(--border);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(255, 152, 0, 0.2);
    color: var(--warning);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--secondary);
    border-radius: 8px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    border: 2px solid var(--accent);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-secondary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--tertiary);
    color: var(--text-primary);
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
    border: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 12px 15px;
    }
    
    .navbar-title {
        font-size: 1.2em;
    }
    
    .container {
        padding: 15px;
        gap: 15px;
    }
    
    .sidebar {
        position: static;
        top: auto;
    }
    
    .tabs-container {
        top: 54px;
        padding: 8px 15px;
    }
    
    .files-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}