/**
 * Shared Styles for All Pages
 * Used by: index.leaf, interactions.html, users.html
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f5f5f5;
}

h1 {
    color: #1a73e8;
    text-align: center;
    margin-bottom: 30px;
}

/* ==========================================================================
   Status Messages
   ========================================================================== */

.loading {
    text-align: center;
    color: #666;
    font-size: 18px;
    margin: 40px 0;
}

.error {
    background-color: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
    color: #d00;
}

.stats {
    text-align: center;
    margin-bottom: 20px;
    color: #666;
}

/* ==========================================================================
   Card Grid Container
   ========================================================================== */

.card-container {
    display: grid;
    gap: 15px;
}

/* ==========================================================================
   Card Component
   ========================================================================== */

.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

/* ==========================================================================
   Avatar
   ========================================================================== */

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #e0e0e0;
    flex-shrink: 0;
}

/* ==========================================================================
   Card Content
   ========================================================================== */

.card-content {
    flex: 1;
}

/* Author/Display Name */
.name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 5px 0;
}

.name--large {
    font-size: 18px;
}

/* Handle/Username */
.handle {
    color: #1a73e8;
    font-size: 14px;
    margin: 0 0 5px 0;
}

.handle a {
    color: #1a73e8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.handle a:hover {
    color: #0d47a1;
    text-decoration: underline;
}

/* Metadata text (followers, etc.) */
.metadata {
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* ==========================================================================
   Post-specific Styles
   ========================================================================== */

/* Post text with line clamping */
.post-text {
    font-size: 14px;
    color: #555;
    margin: 0 0 10px 0;
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Post link */
.post-link {
    color: #1a73e8;
    font-size: 12px;
    margin: 0 0 10px 0;
}

.post-link a {
    color: #1a73e8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-link a:hover {
    color: #0d47a1;
    text-decoration: underline;
}

/* ==========================================================================
   Interactions
   ========================================================================== */

.interactions {
    display: flex;
    gap: 20px;
    align-items: center;
}

.interaction {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #666;
}

.interaction--up {
    color: #2e7d32;
}

.interaction--down {
    color: #d32f2f;
}

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

/* ==========================================================================
   Loading States
   ========================================================================== */

.item-loading {
    color: #999;
    font-style: italic;
}

.item-error {
    color: #d00;
    font-size: 14px;
}

/* ==========================================================================
   Delete Button
   ========================================================================== */

.delete-section {
    margin-top: 8px;
    text-align: center;
}

.delete-btn {
    background-color: #d32f2f;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.delete-btn:hover {
    background-color: #b71c1c;
}

.delete-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* ==========================================================================
   Confirmation Dialog
   ========================================================================== */

.confirmation-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dialog-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.dialog-title {
    font-size: 20px;
    font-weight: 600;
    color: #d32f2f;
    margin: 0 0 16px 0;
}

.dialog-text {
    color: #555;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.dialog-post-info {
    background-color: #f5f5f5;
    border-radius: 4px;
    padding: 12px;
    margin: 12px 0;
    font-size: 14px;
}

.dialog-author {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.dialog-preview {
    color: #666;
    font-style: italic;
}

.dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.dialog-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dialog-btn--cancel {
    background-color: #f1f3f4;
    color: #5f6368;
}

.dialog-btn--cancel:hover {
    background-color: #e8eaed;
}

.dialog-btn--delete {
    background-color: #d32f2f;
    color: white;
}

.dialog-btn--delete:hover {
    background-color: #b71c1c;
}

/* ==========================================================================
   Section Styles (Index Page)
   ========================================================================== */

.admin-section,
.stats-section,
.feeds-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #1a73e8;
}

/* ==========================================================================
   Navigation Cards (Admin Section)
   ========================================================================== */

.nav-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    border: 2px solid transparent;
}

.nav-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #1a73e8;
}

.nav-card-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.nav-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.nav-card-description {
    font-size: 13px;
    color: #666;
    text-align: center;
}

/* ==========================================================================
   Stat Card (Index Page)
   ========================================================================== */

.stat-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 40px;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Feed Card (Index Page)
   ========================================================================== */

.feed-card {
    text-decoration: none;
    cursor: pointer;
}

.feed-card:hover .handle {
    color: #1a73e8;
}

.feed-card .handle {
    color: #666;
    transition: color 0.2s ease;
}

/* ==========================================================================
   Admin Navigation Bar
   ========================================================================== */

.admin-navbar {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    margin: -20px -20px 20px -20px;
    padding: 0 20px;
}

.admin-navbar-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.admin-navbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: color 0.2s ease;
}

.admin-navbar-brand:hover {
    color: #60a5fa;
}

.admin-navbar-links {
    display: flex;
    gap: 8px;
}

.admin-navbar-link {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.admin-navbar-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.admin-navbar-link--active {
    background-color: #1a73e8;
    color: #ffffff;
}

.admin-navbar-link--active:hover {
    background-color: #1557b0;
}

/* ==========================================================================
   Admin Main Content Area
   ========================================================================== */

.admin-main {
    padding-top: 10px;
}

.admin-main h1 {
    margin-top: 0;
}

/* ==========================================================================
   Subtle Admin Link (Index Page)
   ========================================================================== */

.admin-link-subtle {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(102, 102, 102, 0.6);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.admin-link-subtle:hover {
    color: #1a73e8;
    background-color: rgba(26, 115, 232, 0.1);
}

/* ==========================================================================
   Word Cloud Styles
   ========================================================================== */

.word-cloud-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 16px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-height: 400px;
    max-width: 100%;
    overflow: hidden;
}

.word-cloud-word {
    display: inline-block;
    padding: 4px 8px;
    font-weight: 500;
    cursor: default;
    transition: transform 0.3s ease, text-shadow 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    animation: wordFadeIn 0.5s ease forwards;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.word-cloud-word:hover {
    transform: scale(1.15) !important;
    text-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
    z-index: 10;
    position: relative;
}

@keyframes wordFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Word cloud container hover effect - dim other words */
.word-cloud-container:hover .word-cloud-word:not(:hover) {
    opacity: 0.6;
}

/* Word cloud loading state */
.word-cloud-container.loading {
    justify-content: center;
    align-items: center;
}

/* Tooltip enhancement for word cloud */
.word-cloud-word[title] {
    position: relative;
}

.word-cloud-word::after {
    content: attr(data-count) ' uses (' attr(data-ratio) '%)';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

.word-cloud-word:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Word Cloud History Styles
   ========================================================================== */

.wordcloud-history-summary {
    max-width: 700px;
    margin: 0 auto 20px auto;
}

.wordcloud-history-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    justify-content: center;
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.wordcloud-history-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: #333;
}

.wordcloud-history-control input {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ccd1d7;
    font-size: 14px;
    min-width: 120px;
}

.wordcloud-history-control input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.wordcloud-history-button {
    padding: 10px 18px;
    background-color: #1a73e8;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.wordcloud-history-button:hover {
    background-color: #1557b0;
    transform: translateY(-1px);
}

.wordcloud-history-chart {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.wordcloud-history-chart svg {
    display: block;
    max-width: 100%;
}

.wordcloud-history-axis path,
.wordcloud-history-axis line {
    stroke: #c9d2de;
}

.wordcloud-history-axis text {
    fill: #5f6368;
    font-size: 12px;
}

.wordcloud-history-axis-label {
    fill: #4b5563;
    font-size: 12px;
    font-weight: 600;
}

.wordcloud-history-line {
    fill: none;
    stroke-width: 2px;
    cursor: pointer;
    opacity: 0.9;
}

.wordcloud-history-line:hover {
    opacity: 1;
    stroke-width: 3px;
}

.wordcloud-history-line.is-highlighted {
    opacity: 1;
    stroke-width: 3px;
}

.wordcloud-history-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}

.wordcloud-history-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #e0e0e0;
    background: #ffffff;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.wordcloud-history-legend-item::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--legend-color, #1a73e8);
}

.wordcloud-history-legend-item:hover {
    border-color: #1a73e8;
    background: rgba(26, 115, 232, 0.08);
}

.wordcloud-history-legend-item.is-hidden {
    opacity: 0.5;
    text-decoration: line-through;
}

.wordcloud-history-tooltip {
    position: absolute;
    background: rgba(17, 24, 39, 0.95);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Feed Preview Styles
   ========================================================================== */

/* Preview Page Container */
.preview-container {
    max-width: 600px;
    margin: 0 auto;
}

/* Feed Selector */
.feed-selector {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.feed-selector label {
    font-weight: 600;
    color: #333;
}

.feed-selector select {
    padding: 8px 12px;
    font-size: 16px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: white;
    min-width: 200px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.feed-selector select:hover:not(:disabled) {
    border-color: #1a73e8;
}

.feed-selector select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.feed-selector select:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* Preview Card Enhancements */
.preview-card {
    flex-direction: row;
    align-items: flex-start;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    overflow: hidden;
}

.preview-card .card-content {
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.preview-card .post-text {
    max-height: none;
    -webkit-line-clamp: unset;
    overflow: visible;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.preview-card .post-text a {
    color: #1a73e8;
    text-decoration: none;
}

.preview-card .post-text a:hover {
    text-decoration: underline;
}

/* Timestamp */
.timestamp {
    color: #666;
    font-size: 13px;
}

/* Post Stats */
.post-stats {
    display: flex;
    gap: 16px;
    margin: 10px 0;
    padding: 8px 0;
    border-top: 1px solid #eee;
}

.post-stats .stat {
    color: #666;
    font-size: 14px;
}

/* Reply Context */
.reply-context {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: #f5f8fa;
    border-left: 2px solid #ccd6dd;
    border-radius: 0 4px 4px 0;
}

.reply-context-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.reply-context-header a {
    color: #1a73e8;
    text-decoration: none;
}

.reply-context-header a:hover {
    text-decoration: underline;
}

.reply-context-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
}

.reply-context-text {
    font-size: 13px;
    color: #555;
    line-height: 1.3;
    max-height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.reply-context-text a {
    color: #1a73e8;
    text-decoration: none;
}

.reply-context-text a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Embed Styles
   ========================================================================== */

/* Quote Embed */
.embed-quote {
    margin-top: 12px;
    padding: 12px;
    border-left: 3px solid #1a73e8;
    background: #f5f8fa;
    border-radius: 0 8px 8px 0;
}

.embed-quote-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.embed-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.embed-author {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.embed-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.embed-handle {
    font-size: 12px;
    color: #1a73e8;
    text-decoration: none;
}

.embed-handle:hover {
    text-decoration: underline;
}

.embed-quote-text {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.embed-quote-text a {
    color: #1a73e8;
    text-decoration: none;
}

.embed-quote-text a:hover {
    text-decoration: underline;
}

.embed-blocked,
.embed-not-found {
    color: #666;
    font-style: italic;
}

.embed-quote-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: #1a73e8;
    text-decoration: none;
}

.embed-quote-link:hover {
    text-decoration: underline;
}

/* Images Embed */
.embed-images {
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    max-width: 100%;
}

.embed-images img {
    width: 100%;
    max-width: 100%;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.embed-images img:hover {
    opacity: 0.9;
}

.embed-images-single img {
    max-height: 400px;
    object-fit: contain;
    background: #f0f0f0;
}

.embed-images-double {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.embed-images-double img {
    height: 200px;
    object-fit: cover;
}

.embed-images-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.embed-images-grid img {
    height: 150px;
    object-fit: cover;
}

/* External Link Embed */
.embed-external {
    display: flex;
    margin-top: 12px;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
    max-width: 100%;
    box-sizing: border-box;
}

.embed-external:hover {
    background-color: #f5f8fa;
}

.embed-external-thumb {
    width: 120px;
    height: 120px;
    object-fit: cover;
    flex-shrink: 0;
}

.embed-external-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.embed-external-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.embed-external-description {
    font-size: 13px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.embed-external-uri {
    font-size: 12px;
    color: #999;
    margin-top: auto;
}

/* Video Embed */
.embed-video {
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    max-width: 100%;
}

.embed-video-placeholder {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
}

.embed-video-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.embed-video-play {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
}

/* Quote Embed Width Constraint */
.embed-quote {
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.embed-quote-text {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Preview card container specific styles */
.card-container .preview-card {
    width: 100%;
}

/* Ensure preview page stats and loading are centered */
.admin-main .stats,
.admin-main .loading,
.admin-main .error {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   Responsive Styles for Mobile (iPhone 375-414px)
   ========================================================================== */

@media (max-width: 768px) {
    /* Navbar stacking */
    .admin-navbar-content {
        flex-direction: column;
        height: auto;
        padding: 12px 0;
        gap: 10px;
    }
    
    .admin-navbar-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }
    
    .admin-navbar-link {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    /* Reduce body padding */
    body {
        padding: 10px;
    }
    
    .admin-navbar {
        margin: -10px -10px 10px -10px;
        padding: 0 10px;
    }
    
    /* Stack controls vertically */
    .wordcloud-history-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }
    
    .wordcloud-history-control {
        width: 100%;
    }
    
    .wordcloud-history-control input {
        width: 100%;
        min-width: auto;
        box-sizing: border-box;
    }
    
    .wordcloud-history-button {
        width: 100%;
    }
    
    /* Chart container scrollable */
    .wordcloud-history-chart {
        padding: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Smaller legend items */
    .wordcloud-history-legend-item {
        padding: 4px 8px;
        font-size: 11px;
    }
}
