/* Single Page Scroll Design - All content on one page */

/* ===== SHOW INFO PANEL (right panel with context) ===== */
.info-panel {
    display: flex !important;
}

/* ===== SINGLE PAGE CONTENT ===== */
.single-page-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem 450px 1rem;
    background: #f9f9f9;
    min-height: 100vh;
}

/* ===== CONTENT SECTIONS ===== */
.content-section {
    margin-bottom: 4rem;
    scroll-margin-top: 80px;
}

.section-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid #2e7d32;
}

.section-header h2 {
    margin: 0;
    font-size: 1.75rem;
    color: #2e7d32;
    font-weight: 600;
}

.section-content {
    padding: 1rem 0;
}

/* ===== SEARCH BOX ===== */
.search-box {
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    max-width: 500px;
    padding: 0.75rem 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: #2e7d32;
}

/* ===== SCHEMES GRID ===== */
.schemes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.scheme-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
    background: white;
    transition: box-shadow 0.2s;
}

.scheme-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.scheme-card h4 {
    margin: 0 0 0.75rem 0;
    color: #2e7d32;
    font-size: 1.1rem;
}

.scheme-card p {
    margin: 0.5rem 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

.scheme-amount {
    font-weight: 600;
    color: #ff6f00;
    margin-top: 0.75rem;
    font-size: 1rem;
}

/* ===== KNOWLEDGE GRID ===== */
.knowledge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.knowledge-card {
    border-left: 4px solid #2e7d32;
    padding: 1.25rem;
    background: #f1f8e9;
    border-radius: 4px;
}

.knowledge-card h4 {
    margin: 0 0 0.75rem 0;
    color: #2e7d32;
    font-size: 1.1rem;
}

.knowledge-card p {
    margin: 0;
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ===== COMMUNITY FEED ===== */
.community-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.community-post {
    border: 1px solid #ddd;
    padding: 1.25rem;
    border-radius: 8px;
    background: white;
}

.post-author {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2e7d32;
    font-size: 0.95rem;
}

.post-content {
    margin: 0.75rem 0;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.6;
}

.post-meta {
    color: #999;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* ===== LEARNING GRID ===== */
.learning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.learning-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.25rem;
    background: white;
}

.learning-card h4 {
    margin: 0 0 0.75rem 0;
    color: #2e7d32;
    font-size: 1.1rem;
}

.learning-card p {
    margin: 0.5rem 0;
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
}

.tutorial-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: #666;
}

/* ===== FAQ LIST ===== */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.faq-question {
    width: 100%;
    padding: 1rem;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-weight: 500;
    text-align: left;
    transition: background 0.2s;
    font-size: 0.95rem;
}

.faq-question:hover {
    background: #e8f5e9;
}

.faq-icon {
    transition: transform 0.3s;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.faq-item.open .faq-icon {
    transform: rotate(90deg);
}

.faq-answer {
    padding: 1rem;
    background: white;
    display: none;
    line-height: 1.6;
    color: #555;
    font-size: 0.9rem;
}

.faq-item.open .faq-answer {
    display: block;
}

/* ===== SETTINGS PANEL ===== */
.settings-panel {
    max-width: 500px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.setting-item label {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.setting-select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
}

/* ===== HIDE ORIGINAL INPUT AREA ===== */
.input-area {
    display: none !important;
}

/* ===== ACTIVE SIDEBAR ITEM HIGHLIGHTING ===== */
.sidebar-item.active {
    background-color: rgba(46, 125, 50, 0.15);
    border-left-color: #2e7d32;
    font-weight: 600;
    color: #2e7d32;
}

.sidebar-item.active .sidebar-icon {
    transform: scale(1.1);
}

/* ===== FLOATING CHAT PANEL - CENTERED BOTTOM ===== */
.floating-chat-panel {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 560px);
    max-width: 1200px;
    min-width: 400px;
    background: white;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: max-height 0.3s ease;
    max-height: 60px;
}

.floating-chat-panel.expanded {
    max-height: 400px;
}

.floating-chat-panel.minimized {
    max-height: 60px;
}

.floating-chat-header {
    background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
    color: white;
    padding: 0.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
    cursor: pointer;
}

.floating-chat-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.chat-toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.chat-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.floating-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1.5rem;
    background: #f9f9f9;
    min-height: 0;
    display: none;
}

.floating-chat-panel.expanded .floating-chat-messages {
    display: block;
}

.floating-chat-input {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    background: white;
    align-items: center;
    flex-shrink: 0;
    display: none;
}

.floating-chat-panel.expanded .floating-chat-input {
    display: flex;
}

.chat-welcome {
    text-align: center;
    color: #666;
    padding: 1rem;
    font-size: 0.85rem;
}

.chat-message {
    margin-bottom: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    max-width: 70%;
    word-wrap: break-word;
    animation: slideInChat 0.3s ease;
    line-height: 1.6;
    font-size: 1rem;
}

@keyframes slideInChat {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    background: #e8f5e9;
    margin-left: auto;
}

.chat-message.assistant {
    background: white;
    border: 1px solid #e0e0e0;
}

.typing-indicator-chat {
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    padding: 0.75rem !important;
    max-width: 70px !important;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #2e7d32;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}


.floating-chat-input textarea {
    flex: 1;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    max-height: 60px;
    min-height: 38px;
    line-height: 1.4;
}

.floating-chat-input textarea:focus {
    outline: none;
    border-color: #2e7d32;
}

.floating-send-btn {
    background: #2e7d32;
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
    flex-shrink: 0;
}

.floating-send-btn:hover {
    background: #1b5e20;
}

.floating-send-btn:active {
    transform: scale(0.95);
}

/* ===== SMOOTH SCROLLING ===== */
html {
    scroll-behavior: smooth;
}

.floating-chat-messages {
    scroll-behavior: smooth;
}

.floating-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.floating-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.floating-chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.floating-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .floating-chat-panel {
        width: calc(100% - 300px);
        min-width: 300px;
    }
}

/* Mobile (320px - 767px) */
@media (max-width: 767px) {
    /* Adjust content for icon sidebar */
    .app-container {
        padding-left: 70px;
    }

    .single-page-content {
        padding: 1rem 0.75rem 450px 0.75rem;
    }

    .section-header h2 {
        font-size: 1.4rem;
    }

    .schemes-grid,
    .knowledge-grid,
    .learning-grid {
        grid-template-columns: 1fr;
    }

    .floating-chat-panel {
        width: calc(100% - 70px);
        min-width: calc(100% - 70px);
        left: 70px;
        transform: none;
        border-radius: 0;
        max-height: 200px;
    }

    /* When sidebar is expanded, adjust chat panel */
    .sidebar.show ~ .main-content .floating-chat-panel {
        width: calc(100% - 260px);
        left: 260px;
    }

    .floating-chat-header {
        border-radius: 0;
        padding: 0.5rem 1rem;
    }

    .floating-chat-header h3 {
        font-size: 0.85rem;
    }

    .floating-chat-messages {
        padding: 0.75rem 1rem;
    }

    .floating-chat-input {
        padding: 0.75rem 1rem;
    }

    .chat-message {
        max-width: 85%;
        font-size: 0.85rem;
    }

    /* Hide info panel on mobile */
    .info-panel {
        display: none !important;
    }

    /* Mobile sidebar - always show icons, expand on click */
    .sidebar {
        position: fixed;
        left: 0;
        top: var(--header-height);
        bottom: 0;
        width: 70px;
        z-index: 999;
        transition: width 0.3s ease;
        overflow-x: hidden;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
        background: white;
    }

    .sidebar.show {
        width: 260px;
    }

    /* Hide labels by default on mobile */
    .sidebar .sidebar-label {
        display: none;
    }

    .sidebar.show .sidebar-label {
        display: inline;
    }

    /* Center icons when collapsed */
    .sidebar:not(.show) .sidebar-item {
        justify-content: center;
        padding: 1rem 0;
        min-height: 50px;
    }

    .sidebar:not(.show) .sidebar-icon {
        margin-right: 0;
        font-size: 1.5rem;
    }

    /* Hide section titles when collapsed */
    .sidebar:not(.show) .sidebar-title,
    .sidebar:not(.show) .sidebar-subtitle,
    .sidebar:not(.show) .sidebar-divider {
        display: none;
    }

    /* Adjust footer for collapsed state */
    .sidebar:not(.show) .sidebar-footer {
        padding: 0.5rem;
    }

    .sidebar:not(.show) .connection-status {
        justify-content: center;
    }

    .sidebar:not(.show) .status-text {
        display: none;
    }

    .sidebar:not(.show) .status-dot {
        margin: 0 auto;
    }

    /* Mobile sidebar backdrop */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .sidebar.show ~ .sidebar-backdrop,
    .sidebar-backdrop.show {
        display: block;
    }
}

/* Small mobile (320px - 479px) */
@media (max-width: 479px) {
    .section-header h2 {
        font-size: 1.2rem;
    }

    .floating-chat-header h3 {
        font-size: 0.9rem;
    }

    .floating-send-btn {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .scheme-card,
    .knowledge-card,
    .learning-card,
    .community-post {
        padding: 1rem;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .floating-chat-panel {
        display: none !important;
    }

    .single-page-content {
        padding-bottom: 0;
    }

    .content-section {
        page-break-inside: avoid;
    }
}
