/* ===========================================
   AGOCARE - MODERN QUORA-STYLE Q&A
   Features: X/Instagram/Quora best practices
   =========================================== */

/* CSS Variables */
:root {
    --verified-blue: #1d9bf0;
    --verified-gold: #f59b23;
    --verified-green: #00ba7c;
    --healthworker-purple: #8854d0;
    --bg-primary: #ffffff;
    --bg-secondary: #f7f9f9;
    --border-color: #eff3f4;
    --text-primary: #0f1419;
    --text-secondary: #536471;
    --text-muted: #8b98a5;
    --accent-red: #f4212e;
    --accent-blue: #1d9bf0;
    --hover-bg: #f7f9f9;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
}

/* ===========================================
   VERIFIED BADGE SYSTEM (X-Style)
   =========================================== */

/* Base Verified Badge */
.verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
    cursor: help;
    position: relative;
}

.verified-badge::after {
    content: "✓";
    color: white;
    font-size: 11px;
    font-weight: bold;
}

/* Blue Check - Verified Health Worker */
.verified-badge.blue {
    background: var(--verified-blue);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--verified-blue);
}

/* Gold Check - Expert/Top Answerer */
.verified-badge.gold {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    box-shadow: 0 0 0 2px white, 0 0 0 4px #f59b23;
}

/* Green Check - Official Medical Institution */
.verified-badge.green {
    background: var(--verified-green);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--verified-green);
}

/* Purple Check - Health Worker (New) */
.verified-badge.healthworker {
    background: linear-gradient(135deg, #8854d0, #6c5ce7);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--healthworker-purple);
}

/* Badge Tooltip */
.verified-badge[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #0f1419;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 8px;
    z-index: 1000;
    font-weight: 500;
}

/* ===========================================
   HEALTH WORKER CREDENTIAL BADGE
   =========================================== */

.credential-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.credential-badge.doctor {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1565c0;
    border: 1px solid #90caf9;
}

.credential-badge.nurse {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.credential-badge.healthworker {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7);
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

.credential-badge .icon {
    font-size: 14px;
}

.credential-badge .title {
    letter-spacing: 0.3px;
}

/* Credential Details Popup */
.credential-details {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 16px;
    min-width: 280px;
    z-index: 1000;
    display: none;
    margin-top: 8px;
}

.credential-badge:hover .credential-details {
    display: block;
}

.credential-details h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 14px;
}

.credential-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.credential-details .detail-row:last-child {
    border-bottom: none;
}

.credential-details .detail-label {
    color: var(--text-secondary);
}

.credential-details .detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===========================================
   QUESTION CARD - Modern Quora Style
   =========================================== */

.question-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.question-card:hover {
    background: var(--hover-bg);
    box-shadow: var(--card-shadow-hover);
}

/* Question Header */
.question-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

/* Author Avatar */
.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-avatar .initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 700;
    font-size: 18px;
}

.author-avatar .initials.medical {
    background: linear-gradient(135deg, #11998e, #38ef7d);
}

/* Author Details */
.author-details {
    flex: 1;
    min-width: 0;
}

.author-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 15px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.author-name .name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.author-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
    flex-wrap: wrap;
}

.author-meta .separator {
    color: var(--text-muted);
    font-size: 10px;
}

/* ===========================================
   QUESTION CONTENT
   =========================================== */

.question-content {
    margin-bottom: 12px;
    padding-left: 60px;
}

.question-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.question-text {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Category Tag */
.category-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.category-tag:hover {
    background: #e8eaed;
    color: var(--text-primary);
}

/* ===========================================
   QUESTION ACTIONS (Instagram/Quora style)
   =========================================== */

.question-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 0 60px;
    border-top: 1px solid var(--border-color);
}

.action-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.action-btn .icon {
    font-size: 18px;
}

.action-btn .count {
    font-weight: 600;
    min-width: 20px;
}

.action-btn.upvote-btn:hover,
.action-btn.upvote-btn.active {
    color: var(--accent-blue);
    background: rgba(29, 155, 240, 0.1);
}

.action-btn.answer-btn:hover,
.action-btn.answer-btn.active {
    color: var(--verified-green);
    background: rgba(0, 186, 124, 0.1);
}

.action-btn.bookmark-btn:hover,
.action-btn.bookmark-btn.active {
    color: var(--verified-gold);
    background: rgba(245, 155, 35, 0.1);
}

.action-btn.share-btn:hover {
    color: var(--accent-blue);
    background: rgba(29, 155, 240, 0.1);
}

/* ===========================================
   ANSWERS SECTION
   =========================================== */

.answers-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid var(--border-color);
}

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

.answers-count {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.answers-count span {
    color: var(--text-secondary);
    font-weight: 400;
}

/* Answer Card */
.answer-card {
    padding: 16px;
    padding-left: 76px;
    margin-bottom: 12px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.answer-card:hover {
    background: var(--hover-bg);
}

.answer-card.accepted {
    border-left-color: var(--verified-green);
    background: rgba(0, 186, 124, 0.05);
}

.answer-card.healthworker-answer {
    border-left-color: var(--verified-blue);
    background: rgba(29, 155, 240, 0.03);
}

/* Accepted Answer Badge */
.accepted-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(0, 186, 124, 0.15);
    color: var(--verified-green);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.accepted-badge::before {
    content: "✓";
    font-weight: bold;
}

/* Answer Author Info */
.answer-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.answer-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.answer-author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.answer-author-avatar .initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.answer-author-avatar .initials.doctor {
    background: linear-gradient(135deg, #11998e, #38ef7d);
}

.answer-author-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.answer-author-credentials {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===========================================
   LOADING & EMPTY STATES
   =========================================== */

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

.empty-state, .error-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .icon, .error-state .icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h3, .error-state h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p, .error-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ===========================================
   MODERN MODALS
    =========================================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

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

.modal-content {
    background: var(--bg-primary);
    border-radius: 20px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 1;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--hover-bg);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #e8eaed;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

/* ===========================================
   FORM ELEMENTS
   =========================================== */

.form-group {
    margin-bottom: 16px;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--bg-primary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(29, 155, 240, 0.1);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

/* ===========================================
   BUTTONS
   =========================================== */

.btn-primary {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #1a8cd8;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--hover-bg);
    color: var(--text-primary);
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-answer {
    background: var(--verified-green);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-answer:hover {
    background: #00a872;
    transform: translateY(-1px);
}

/* ===========================================
   FILTER BAR
   =========================================== */

.filters-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 16px;
}

.filter-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: rgba(29, 155, 240, 0.1);
    color: var(--accent-blue);
}

.filter-btn.active {
    background: var(--text-primary);
    color: white;
}

/* ===========================================
   SEARCH
   =========================================== */

.search-container {
    position: relative;
    margin-bottom: 20px;
}

.search-container .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
}

.search-container input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 15px;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.search-container input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: var(--bg-primary);
}

/* ===========================================
   FEED HEADER
   =========================================== */

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

.feed-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.ask-question-btn {
    background: linear-gradient(135deg, var(--accent-red), #e0245e);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ask-question-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 33, 46, 0.3);
}

/* ===========================================
   STATS CARDS
   =========================================== */

.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 140px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    text-align: center;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-card .label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stat-card.urgent .value { color: var(--accent-red); }
.stat-card.unanswered .value { color: var(--accent-blue); }
.stat-card.answered .value { color: var(--verified-green); }

/* ===========================================
   TOAST NOTIFICATIONS
   =========================================== */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text-primary);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 11000;
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.toast.success { background: var(--verified-green); }
.toast.error { background: var(--accent-red); }
.toast.info { background: var(--accent-blue); }

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 768px) {
    .question-content,
    .question-actions,
    .answers-header {
        padding-left: 0;
    }
    
    .question-card {
        padding: 12px;
    }
    
    .author-avatar {
        width: 40px;
        height: 40px;
    }
    
    .action-btn {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .action-btn .icon {
        font-size: 16px;
    }
    
    .feed-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .ask-question-btn {
        justify-content: center;
    }
}

/* ===========================================
   REAL-TIME INDICATOR
   =========================================== */

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(0, 186, 124, 0.1);
    color: var(--verified-green);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 12px;
}

.live-indicator::before {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--verified-green);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* New Question Notification */
.new-questions-banner {
    background: linear-gradient(135deg, var(--accent-blue), #1a8cd8);
    color: white;
    padding: 10px 20px;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    animation: slideDown 0.3s ease;
    display: none;
}

.new-questions-banner:hover {
    background: linear-gradient(135deg, #1a8cd8, #1588d4);
}

.new-questions-banner.show {
    display: block;
}

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