/* ═══════════════════════════════════════════════════════════════════════════
   UpThread - LinkedIn Autoposter
   Professional, clean styling with LinkedIn-authentic design
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* LinkedIn Colors */
    --linkedin-blue: #0A66C2;
    --linkedin-blue-dark: #004182;
    --linkedin-blue-light: #378fe9;
    --linkedin-bg: #F4F2EE;
    --linkedin-border: #00000014;
    
    /* Text Colors */
    --text-primary: #000000E6;
    --text-secondary: #00000099;
    --text-light: #00000066;
    
    /* Safety Colors */
    --safety-red: #DC2626;
    --safety-orange: #F59E0B;
    --safety-yellow: #FBBF24;
    --safety-lime: #84CC16;
    --safety-green: #10B981;
    
    /* Layout */
    --sidebar-width: 300px;
    --max-width: 1128px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--linkedin-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOP BAR
   ═══════════════════════════════════════════════════════════════════════════ */

.topbar {
    background: white;
    border-bottom: 1px solid var(--linkedin-border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    height: 32px;
    width: auto;
}

.sidebar-toggle {
    background: var(--linkedin-blue);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none; /* Show on mobile */
}

.sidebar-toggle:hover {
    background: var(--linkedin-blue-dark);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.main-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */

.sidebar {
    background: linear-gradient(180deg, var(--linkedin-blue) 0%, var(--linkedin-blue-dark) 100%);
    border-radius: 8px;
    padding: 20px;
    color: white;
    height: fit-content;
    position: sticky;
    top: 80px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sidebar-header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.sidebar-header p {
    font-size: 12px;
    opacity: 0.8;
}

.sidebar-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.sidebar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.sidebar-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.section-caption {
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 12px;
}

/* API Status */
.status-badge {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--safety-green);
}

.status-badge.error {
    background: rgba(220, 38, 38, 0.2);
    border-color: var(--safety-red);
}

.status-icon {
    font-size: 16px;
}

.status-text {
    font-size: 14px;
    font-weight: 500;
}

/* Safety Slider */
.slider-container {
    margin: 16px 0;
}

.safety-slider {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, 
        var(--safety-red) 0%, 
        var(--safety-orange) 25%, 
        var(--safety-yellow) 50%, 
        var(--safety-lime) 75%, 
        var(--safety-green) 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.safety-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    cursor: grab;
    transition: transform 0.2s ease;
}

.safety-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.safety-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.safety-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    cursor: grab;
    transition: transform 0.2s ease;
}

.safety-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
}

.safety-slider::-moz-range-thumb:active {
    cursor: grabbing;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.safety-info {
    background: rgba(255,255,255,0.1);
    padding: 12px;
    border-radius: 8px;
    margin-top: 12px;
}

.safety-label {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.safety-desc {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.safety-value {
    font-size: 11px;
    opacity: 0.7;
}

/* Buttons */
.btn-secondary {
    width: 100%;
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.diagnostic-result {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 12px;
}

/* Quick Tips */
.tips-list {
    list-style: none;
    font-size: 12px;
    line-height: 1.6;
}

.tips-list li {
    margin-bottom: 8px;
    opacity: 0.9;
}

.tips-list strong {
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════════════ */

.content {
    min-height: calc(100vh - 120px);
}

.content h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   COMPOSER CARD
   ═══════════════════════════════════════════════════════════════════════════ */

.composer-card {
    background: white;
    border: 1px solid var(--linkedin-border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.04);
    margin-bottom: 20px;
    transition: box-shadow 0.2s ease;
}

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

.composer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--linkedin-border);
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--linkedin-blue), var(--linkedin-blue-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

.composer-info {
    flex: 1;
}

.company-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

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

#postInput {
    width: 100%;
    border: 1px solid #00000029;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    resize: vertical;
    min-height: 120px;
    margin-bottom: 16px;
    transition: border-color 0.2s ease;
}

#postInput:focus {
    outline: none;
    border-color: var(--linkedin-blue);
    box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.1);
}

#postInput::placeholder {
    color: var(--text-secondary);
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.action-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-upload-label {
    padding: 8px 16px;
    border: 1px solid var(--linkedin-border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload-label:hover {
    border-color: var(--linkedin-blue);
    color: var(--linkedin-blue);
    background: rgba(10, 102, 194, 0.05);
}

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

.action-right {
    display: flex;
    gap: 12px;
}

.visibility-select {
    padding: 10px 16px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 180px;
}

.visibility-select:hover {
    border-color: var(--linkedin-blue);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.visibility-select:focus {
    outline: none;
    border-color: var(--linkedin-blue);
}

.btn-primary {
    background: linear-gradient(135deg, var(--linkedin-blue) 0%, var(--linkedin-blue-dark) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(10, 102, 194, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--linkedin-blue-dark) 0%, #003366 100%);
    box-shadow: 0 4px 12px rgba(10, 102, 194, 0.4);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #CCCCCC;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   POSTS CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */

.posts-container {
    margin-top: 20px;
}

.post-card {
    background: white;
    border: 1px solid var(--linkedin-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideIn 0.4s ease-out;
    position: relative;
    overflow: hidden;
}

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

.post-card:hover {
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--linkedin-blue), #0084BF, #00A0DC);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.post-card:hover::before {
    opacity: 1;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--linkedin-border);
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--linkedin-blue), var(--linkedin-blue-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.post-info {
    flex: 1;
}

.post-company {
    font-weight: 600;
    font-size: 14px;
}

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

.post-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.post-hashtags {
    margin-bottom: 8px;
}

.hashtag {
    color: var(--linkedin-blue);
    font-weight: 600;
    margin-right: 8px;
}

.post-cta {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 12px;
}

.post-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--linkedin-border);
}

.btn-approve,
.btn-edit {
    flex: 1;
    padding: 10px 16px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-approve {
    background: white;
    color: var(--linkedin-blue);
    border: 2px solid var(--linkedin-blue);
}

.btn-approve:hover {
    background: var(--linkedin-blue);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(10, 102, 194, 0.3);
}

.btn-edit {
    background: white;
    color: var(--text-secondary);
    border: 2px solid #D1D5DB;
}

.btn-edit:hover {
    border-color: var(--linkedin-blue);
    color: var(--linkedin-blue);
    transform: translateY(-1px);
}

/* Messages */
.info-message,
.success-message,
.error-message,
.warning-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.info-message {
    background: #E3F2FD;
    border: 1px solid #2196F3;
    color: #0D47A1;
}

.success-message {
    background: #EDF7ED;
    border: 1px solid #4CAF50;
    color: #1B5E20;
}

.error-message {
    background: #FFEBEE;
    border: 1px solid #F44336;
    color: #C62828;
}

.warning-message {
    background: #FFF3E0;
    border: 1px solid #FF9800;
    color: #E65100;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 4px solid rgba(10, 102, 194, 0.1);
    border-top-color: var(--linkedin-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 968px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: relative;
        top: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .sidebar.hidden {
        display: none;
    }
}

@media (max-width: 640px) {
    .composer-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-right {
        flex-direction: column;
    }
    
    .visibility-select {
        width: 100%;
    }
    
    .post-actions {
        flex-direction: column;
    }
}