html, body {
    height: 100%;
    margin: 0;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

.layout {
    display: grid;
    grid-template-columns: auto 640px 240px auto; /* left | center | right widths */
    height: 100vh; /* full height */
    gap: 5px;
}

.tab-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    padding: 8px 0;
    position: relative;
    transition: color 0.3s ease;
    font-family: InterVariable, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.column {
    overflow: hidden; /* default hidden */
}

textarea {
    font-family: "Roboto", sans-serif;
}

/* Scrollable center column */
.column.center {
    margin-top: 66px;
    overflow-y: scroll; /* enable scroll */
    scrollbar-width: none; /* Firefox: hide scrollbar */
    -ms-overflow-style: none; /* IE & Edge */
    background: var(--background);
}

/* Chrome, Safari, Opera: hide scrollbar */
.column.center::-webkit-scrollbar {
    display: none;
}

.column.left {
    display: flex;
    margin-top: 66px;
    flex-direction: column;
    gap: 10px;
    align-content: normal;
    padding: 20px;
    background: var(--background);
    border-top-left-radius: 35px;
    align-items: center;
}

.column.right {
    margin-top: 66px;
    padding: 20px;
    background: var(--background);
    border-top-right-radius: 35px;
}
.search-bar {
    background-color: #3b82f6;
    padding: 8px 15px;
    width: 110px;
    border: none;
    outline: none;
    font-size: 14px;
    color: white;
}

.search-button {
    background: var(--secondary);
    border: none;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    width: 40px;
    height: 36px;
    display: flex;
    color: var(--background);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .15s ease, filter .2s ease;
    flex-shrink: 0; /* Prevent button from shrinking */
}

.search-button:hover { transform: translateY(-1px); filter: brightness(1.05); }

/* Mobile Responsive Layout */
@media (max-width: 768px) {
    .layout {
        grid-template-columns: auto 1fr auto; /* left spacer | center | right spacer */
        grid-template-areas: 
            "left-spacer center right-spacer";
    }
    
    /* Hide side columns on mobile */
    .column.left,
    .column.right {
        display: none;
    }
    
    /* Center column takes full width on mobile */
    .column.center {
        max-width: 100%;
        width: 100%;
        border-left: none;
        border-right: none;
        padding: 0 16px; /* Add some padding for mobile */
    }
    
    /* Adjust header for mobile */
    .header {
        padding: 0 16px;
    }
    
    /* Make threads section responsive */
    .threads {
        padding: 0;
    }
    
    /* Adjust tweet spacing for mobile */
    .tweet {
        margin-bottom: 16px;
        padding: 12px;
    }
    
        /* Fix author alias text wrapping on mobile */
        .author_alias {
            white-space: normal !important;
            word-wrap: break-word;
            overflow-wrap: break-word;
            word-break: break-word;
            max-width: 100%;
            overflow: visible !important;
        }
        
        /* Hide all scroll bars on mobile */
        * {
            scrollbar-width: none !important; /* Firefox */
            -ms-overflow-style: none !important; /* IE and Edge */
        }
        
        *::-webkit-scrollbar {
            display: none !important; /* Chrome, Safari, Opera */
        }
        
        /* Ensure scrolling still works but without visible scrollbars */
        body, html {
            overflow-x: hidden !important;
            -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        }
        
        .column.center {
            overflow-y: auto !important;
            scrollbar-width: none !important;
            -ms-overflow-style: none !important;
        }
        
        .column.center::-webkit-scrollbar {
            display: none !important;
        }
    }

/* Tablet responsive adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .layout {
        grid-template-columns: auto 200px 1fr 200px auto; /* Smaller side columns */
    }
    
    .column.left,
    .column.right {
        width: 200px;
    }
    
    .column.center {
        max-width: calc(100vw - 400px); /* Account for side columns */
    }
}
.search-button:active { transform: translateY(0); filter: brightness(.95); }

.search-bar::placeholder {
    color: var(--primary);
}

.search-container {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    max-width: 90%;
}

.search-container form {
    display: flex;
    align-items: center;
    width: 100%;
}

.search-container label {
    flex: 1;
    display: flex;
    align-items: center;
}

.search-container input {
    flex: 1;
    outline: none;
    background: var(--secondary);
    color: var(--primary);
    padding: 10px 12px;
    font-size: 14px;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    transition: border-color .2s, background .2s;
    width: 80%;
    min-width: 0; /* Allow input to shrink */
}

.search-container input::placeholder {
    color: var(--background);
}

.author_alias {
    color: var(--primary);
    font-size: 15px;
    overflow: hidden;
    font-weight: bold;
    white-space: nowrap;
    padding-right: 5px;
    text-decoration: none;
    font-family: "Roboto", sans-serif;
    text-transform: lowercase;
}

.reply-input {
    flex: 1;
    background-color: #333;
    border: none;
    border-radius: 20px;
    padding: 12px 16px;
    color: #ffffff;
    font-size: 15px;
    width: 250px;
    resize: none;
    min-height: 44px;
}

.reply-input-section {
    padding-top: 20px;
}

.reply-input-container {
    display: flex;
    gap: 12px;
}

button.submit_reply_button {
    background-color: var(--background);
    color: var(--primary);
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    height: 40px;
    border: 1px solid;
}

.toggle-btn {
    background-color: #6b7280;
    color: white;
    border: none;
    padding: 8px 8px;
    margin-top: 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 10px;
    transition: background-color 0.2s;
    width: auto;
    display: inline-block;
}

/* Container for toggle button */
.toggle-btn-container {
    width: auto;
    display: inline-block;
}

.text-container {
    position: relative;
}

.main.expanded {
    max-height: 2000px;
}

/* Adviser Indicator */
.adviser-indicator {
    color: #5b86e5;
    font-size: 1em;
    display: inline-block;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 1;
    }
}

.fa-pepper-hot {
    --fa: "\f816";
    margin-right: -5px;
    transform: rotate(-45deg);
}

.shade-1 { color: #439750; }
.shade-2 { color: #e72b49; }
.shade-3 { color: #e72b49; }
.shade-4 { color: #e72b49; }
.shade-5 { color: #e72b49; }
.shade-6 { color: #e72b49; }
.shade-7 { color: #e72b49; }