/* Meta Auto-Posting Platform - Main Stylesheet */

/* CSS Reset and Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    line-height: 1.5;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: #F5F6F7;
    color: #1C1E21;
    min-height: 100vh;
}

/* Typography */
h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 24px;
}

h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
}

h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

p {
    margin-bottom: 16px;
}

a {
    color: #1877F2;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #FFFFFF;
    border-right: 1px solid #DDDEE1;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #DDDEE1;
}

.sidebar-logo {
    font-size: 18px;
    font-weight: 600;
    color: #1877F2;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo svg {
    width: 32px;
    height: 32px;
}

.sidebar-nav {
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #1C1E21;
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 12px;
}

.nav-item:hover {
    background-color: #F0F2F5;
    text-decoration: none;
}

.nav-item.active {
    background-color: #1877F2;
    color: #FFFFFF;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px;
    min-height: 100vh;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #DDDEE1;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: #1C1E21;
    margin: 0;
}

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

/* Cards */
.card {
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin-bottom: 16px;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #DDDEE1;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #1877F2;
    color: #FFFFFF;
}

.btn-primary:hover:not(:disabled) {
    background-color: #166FE5;
}

.btn-secondary {
    background-color: #E4405F;
    color: #FFFFFF;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #D6334A;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid #DDDEE1;
    color: #1C1E21;
}

.btn-outline:hover:not(:disabled) {
    background-color: #F0F2F5;
}

.btn-danger {
    background-color: #DC3545;
    color: #FFFFFF;
}

.btn-danger:hover:not(:disabled) {
    background-color: #C82333;
}

.btn-success {
    background-color: #28A745;
    color: #FFFFFF;
}

.btn-success:hover:not(:disabled) {
    background-color: #218838;
}

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

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

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #1C1E21;
}

.form-label.required::after {
    content: ' *';
    color: #DC3545;
}

.form-control {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
    border: 1px solid #DDDEE1;
    border-radius: 6px;
    background-color: #FFFFFF;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #1877F2;
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.2);
}

.form-control:disabled {
    background-color: #F5F6F7;
    cursor: not-allowed;
}

textarea.form-control {
    height: auto;
    min-height: 120px;
    padding: 12px;
    resize: vertical;
}

.form-hint {
    font-size: 12px;
    color: #65676B;
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: #DC3545;
    margin-top: 4px;
}

/* Checkbox and Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    user-select: none;
}

/* Platform Selection */
.platform-selection {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.platform-option {
    flex: 1;
    min-width: 150px;
    padding: 16px;
    border: 2px solid #DDDEE1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.platform-option:hover {
    border-color: #BCC0C4;
}

.platform-option.selected {
    border-color: #1877F2;
    background-color: rgba(24, 119, 242, 0.05);
}

.platform-option input {
    display: none;
}

.platform-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 8px;
}

.platform-name {
    font-weight: 500;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
}

.badge-pending {
    background-color: #FFF3CD;
    color: #856404;
}

.badge-processing {
    background-color: #CCE5FF;
    color: #004085;
}

.badge-posted {
    background-color: #D4EDDA;
    color: #155724;
}

.badge-failed {
    background-color: #F8D7DA;
    color: #721C24;
}

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

.stat-card {
    background: #FFFFFF;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 12px;
    color: #65676B;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    color: #1C1E21;
}

.stat-value.pending {
    color: #FFC107;
}

.stat-value.posted {
    color: #28A745;
}

.stat-value.failed {
    color: #DC3545;
}

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

.post-item {
    background: #FFFFFF;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.post-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    object-fit: cover;
    background-color: #F5F6F7;
}

.post-content {
    flex: 1;
    min-width: 0;
}

.post-caption {
    font-size: 14px;
    color: #1C1E21;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 12px;
    color: #65676B;
}

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

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

/* Image Upload */
.image-upload-area {
    border: 2px dashed #DDDEE1;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #FAFAFA;
}

.image-upload-area:hover {
    border-color: #1877F2;
    background-color: rgba(24, 119, 242, 0.05);
}

.image-upload-area.has-image {
    padding: 16px;
}

.image-upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    color: #65676B;
}

.image-upload-text {
    color: #65676B;
    margin-bottom: 8px;
}

.image-upload-hint {
    font-size: 12px;
    color: #8A8D91;
}

.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 6px;
}

.image-preview-container {
    position: relative;
    display: inline-block;
}

.image-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #FFFFFF;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1877F2 0%, #E4405F 100%);
}

.login-card {
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    font-size: 24px;
    font-weight: 600;
    color: #1877F2;
    margin-bottom: 8px;
}

.login-subtitle {
    color: #65676B;
    font-size: 14px;
}

.login-form .btn {
    width: 100%;
    margin-top: 8px;
}

/* Alert Messages */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background-color: #D4EDDA;
    color: #155724;
    border: 1px solid #C3E6CB;
}

.alert-danger {
    background-color: #F8D7DA;
    color: #721C24;
    border: 1px solid #F5C6CB;
}

.alert-warning {
    background-color: #FFF3CD;
    color: #856404;
    border: 1px solid #FFEAA7;
}

.alert-info {
    background-color: #CCE5FF;
    color: #004085;
    border: 1px solid #B8DAFF;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #65676B;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #1C1E21;
}

.empty-state-text {
    margin-bottom: 24px;
}

/* Settings Page */
.settings-section {
    margin-bottom: 32px;
}

.settings-section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #DDDEE1;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #F5F6F7;
    border-radius: 8px;
    margin-bottom: 16px;
}

.connection-status.connected {
    background: #D4EDDA;
}

.connection-status.disconnected {
    background: #F8D7DA;
}

.connection-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
}

.connection-info {
    flex: 1;
}

.connection-name {
    font-weight: 500;
}

.connection-detail {
    font-size: 12px;
    color: #65676B;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid #DDDEE1;
    margin-top: auto;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1877F2;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-logout {
    font-size: 12px;
    color: #65676B;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #FFFFFF;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

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

    .post-item {
        flex-direction: column;
    }

    .post-thumbnail {
        width: 100%;
        height: 160px;
    }

    .login-card {
        margin: 16px;
        padding: 24px;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #65676B;
}

.text-success {
    color: #28A745;
}

.text-danger {
    color: #DC3545;
}

.text-warning {
    color: #FFC107;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.d-none {
    display: none !important;
}

.d-flex {
    display: flex;
}

.gap-2 {
    gap: 16px;
}

.hidden-file-input {
    display: none;
}
