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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

.top-bar {
    background: white;
    padding: 20px 40px;
    margin: -20px -20px 30px -20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100vw;
    max-width: 100vw;
    box-sizing: border-box;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.top-bar-left h1 {
    font-size: 1.8em;
    margin: 0;
    color: #2d3748;
}

.top-bar-left h1 a {
    text-decoration: none !important;
    color: inherit;
    cursor: pointer;
}

.top-bar-left p {
    font-size: 0.95em;
    margin: 0;
    color: #4a5568;
    opacity: 0.9;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.language-menu-container {
    position: relative;
}

.header-badge {
    display: inline-block;
    background: #2d3748;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.header-badge:hover {
    background: #1a202c;
}

.language-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.language-menu-dropdown.show {
    display: block;
}

.language-menu-item {
    display: block;
    padding: 10px 16px;
    color: #4a5568;
    text-decoration: none;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.language-menu-item:hover {
    background-color: #f0f0f0;
    color: #2d3748;
}

.user-menu-container {
    position: relative;
}

.user-display-name {
    font-size: 0.9em;
    color: #4a5568;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.user-display-name:hover {
    background-color: #f0f0f0;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    z-index: 1000;
    overflow: hidden;
}

.user-menu-dropdown.show {
    display: block;
}

.user-menu-item {
    display: block;
    padding: 10px 16px;
    color: #4a5568;
    text-decoration: none;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.user-menu-item:hover {
    background-color: #f0f0f0;
    color: #2d3748;
}

.login-btn {
    padding: 8px 20px;
    background: #f0f0f0;
    color: #4a5568;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s;
}

.login-btn:hover {
    background: #e8e8e8;
    border-color: #d0d0d0;
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

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

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: #2d3748;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: #f0f0f0;
    color: #2d3748;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin: 0 0 20px 0;
    color: #4a5568;
    font-size: 0.95em;
}

.google-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 5px;
    color: #3c4043;
    font-size: 0.95em;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: box-shadow 0.2s, background-color 0.2s;
}

.google-login-btn:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background-color: #f8f9fa;
}

.google-login-btn:active {
    background-color: #f1f3f4;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .top-bar {
        padding: 15px 20px;
        margin: -10px -10px 20px -10px;
        flex-wrap: wrap;
    }
    
    .top-bar-left {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        width: 100%;
    }
    
    .top-bar-left p {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
    }
    
    .top-bar-right {
        width: 100%;
        justify-content: flex-end;
        margin-top: 10px;
    }
    
    .language-menu-dropdown {
        right: auto;
        left: 0;
        min-width: 200px;
    }
    
    .user-menu-dropdown {
        right: auto;
        left: 0;
    }
    
    .post-card {
        padding: 15px;
    }
    
    .container {
        padding: 0;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.controls {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.form-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: end;
}

.form-field {
    flex: 1;
    min-width: 200px;
}

.form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn:hover {
    background: #5568d3;
}

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

.loading {
    text-align: center;
    padding: 40px;
    color: #2d3748;
    font-size: 1.2em;
}

.error {
    background: #ff6b6b;
    color: white;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.meta-info {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.meta-info h3 {
    margin-bottom: 10px;
    color: #333;
}

.meta-info pre {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 12px;
}

.posts-container {
    display: grid;
    gap: 20px;
}

.post-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.post-id {
    font-weight: 600;
    color: #667eea;
    font-size: 1.1em;
}

.post-date {
    color: #666;
    font-size: 0.9em;
}

.post-languages {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.language-badge {
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.post-embed {
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    background: #f9f9f9;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.embed-wrapper {
    width: 100%;
    max-width: 100%;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.post-embed > div {
    width: 100% !important;
    max-width: 100% !important;
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    box-sizing: border-box !important;
}

.post-embed iframe {
    border: none;
    display: block;
    margin: 0 auto;
    max-width: 600px !important;
    width: 100% !important;
    box-sizing: border-box;
}

@media (min-width: 769px) {
    .post-embed iframe {
        width: 600px !important;
    }
}

.post-embed > div {
    width: 100% !important;
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

.post-embed > div > * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.post-embed > div blockquote {
    margin: 0 auto !important;
    display: block !important;
}

.post-embed > div .twitter-tweet {
    margin: 0 auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
    text-align: left !important;
    width: 100% !important;
    max-width: 550px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

.post-embed > div .twitter-tweet iframe,
.post-embed > div iframe[src*="twitter.com"],
.post-embed > div iframe[src*="platform.twitter.com"] {
    width: 100% !important;
    max-width: 550px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
    display: block !important;
}

@media (min-width: 769px) {
    .post-embed > div .twitter-tweet {
        width: 550px !important;
    }
    
    .post-embed > div .twitter-tweet iframe,
    .post-embed > div iframe[src*="twitter.com"],
    .post-embed > div iframe[src*="platform.twitter.com"] {
        width: 550px !important;
    }
}

.post-embed > div .instagram-media {
    margin: 0 auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
    width: 100% !important;
    max-width: 600px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

.post-embed > div .instagram-media iframe {
    width: 100% !important;
    max-width: 600px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

@media (min-width: 769px) {
    .post-embed > div .instagram-media {
        width: 600px !important;
    }
    
    .post-embed > div .instagram-media iframe {
        width: 600px !important;
    }
}

.post-embed .embed-loading {
    padding: 40px;
    text-align: center;
    color: #666;
    font-size: 0.95em;
    display: block;
}

.post-embed .embed-error {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 0.9em;
}

.post-embed .provider-badge {
    display: inline-block;
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 0.85em;
    margin-bottom: 10px;
    text-transform: capitalize;
    font-weight: 600;
    color: #333;
}

.post-contribution {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.post-contribution h4 {
    margin-bottom: 10px;
    color: #333;
}

.post-contribution .translation {
    font-size: 0.95em;
    font-weight: 400;
    color: #4a5568;
    margin-bottom: 10px;
    white-space: pre-line;
}

.post-contribution .explanation {
    font-size: 0.95em;
    font-weight: 400;
    color: #4a5568;
    white-space: pre-line;
}

.post-engagement {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.engagement-item {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: default;
    user-select: none;
    color: #9e9e9e; /* Gray for neutral state */
}

.engagement-item.clickable {
    cursor: pointer;
    transition: opacity 0.2s;
}

.engagement-item.clickable:hover {
    opacity: 0.7;
}

.engagement-item.helpful {
    color: #9e9e9e; /* Gray for neutral state */
}

.engagement-item.confusing {
    color: #9e9e9e; /* Gray for neutral state */
}

/* Active state styling - when user has selected this engagement type */
.engagement-item.helpful.active {
    color: #4caf50; /* Bright green */
    font-weight: 700; /* Bold */
}

.engagement-item.confusing.active {
    color: #ff9800; /* Bright orange */
    font-weight: 700; /* Bold */
}

.post-author {
    color: #666;
    font-size: 0.9em;
}

.pagination {
    text-align: center;
    margin-top: 20px;
}

.pagination button {
    margin: 0 5px;
}

/* Imgur embed blockquote */
.post-embed > div .imgur-embed-pub {
    margin: 0 auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
    width: 100% !important;
    max-width: 540px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

.post-embed > div .imgur-embed-pub iframe {
    width: 100% !important;
    max-width: 540px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

@media (min-width: 769px) {
    .post-embed > div .imgur-embed-pub {
        width: 540px !important;
    }
    
    .post-embed > div .imgur-embed-pub iframe {
        width: 540px !important;
    }
}
