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

:root {
    --primary-color: #1EC9E1;        /* Hero color */
    --accent-color: #FF8A1E;         /* Accent orange */
    --secondary-color: #2E5156;      /* Dark gray */
    --light-gray: #F8FBFC;           /* Light gray background */
    --border-color: #e1e8ed;
    --hover-color: #F8FBFC;
    --success-color: #17bf63;
    --text-color: #2E5156;           /* Dark gray for text */
    --text-secondary: #657786;
    --tertiary-purple: #5B33E7;      /* Tertiary purple */
    --tertiary-yellow: #FFD71E;      /* Tertiary yellow */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--light-gray);
    color: var(--text-color);
    line-height: 1.6;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #1a3538 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-box {
    background: white;
    padding: 40px 50px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.login-box h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-box input[type="password"] {
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.login-box input[type="password"]:focus {
    border-color: var(--primary-color);
}

.login-box button {
    padding: 12px 24px;
    font-size: 1rem;
}

.login-error {
    color: #e74c3c;
    margin-top: 15px;
    font-size: 0.9rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    margin-bottom: 40px;
    text-align: center;
}

.header-image {
    width: 100%;
    max-width: 1200px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.version-info {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-top: 8px;
}

.upload-section {
    margin-bottom: 40px;
}

.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: var(--hover-color);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background-color: var(--hover-color);
}

/* Compact mode when files have been uploaded */
.upload-area.compact {
    padding: 20px;
}

.upload-area.compact .upload-option svg {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
}

.upload-area.compact .upload-option p {
    font-size: 0.9rem;
}

.upload-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.upload-option svg {
    color: var(--text-secondary);
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.upload-option p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
    line-height: 1.4;
}

.upload-option:hover svg {
    color: var(--primary-color);
    transform: scale(1.1);
}

.upload-local:hover svg {
    color: var(--primary-color);
}

.upload-drive:hover .google-drive-logo {
    transform: scale(1.1);
}

.upload-youtube:hover svg path {
    opacity: 0.8;
}

.youtube-url-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 15px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
}

.youtube-url-input input[type="text"] {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.youtube-url-input input[type="text"]:focus {
    border-color: var(--primary-color);
}

/* Transcript upload option */
.upload-transcript:hover svg {
    color: var(--primary-color);
}

/* Transcript input panel */
.transcript-input-panel {
    margin-top: 15px;
    padding: 20px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
}

.transcript-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.transcript-input-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.transcript-input-body .form-group {
    margin-bottom: 12px;
}

.transcript-input-body label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.transcript-input-body input[type="text"],
.transcript-input-body textarea {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.transcript-input-body input[type="text"]:focus,
.transcript-input-body textarea:focus {
    border-color: var(--primary-color);
}

.transcript-file-drop {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.transcript-file-drop:hover,
.transcript-file-drop.drag-over {
    border-color: var(--primary-color);
    background-color: var(--hover-color);
}

.transcript-file-drop a {
    color: var(--primary-color);
    text-decoration: underline;
}

.transcript-file-name {
    font-size: 0.85rem;
    color: var(--primary-color);
    margin-bottom: 12px;
    padding: 6px 10px;
    background: var(--hover-color);
    border-radius: 6px;
}

.transcript-input-body .btn-primary {
    width: 100%;
}

/* Transcript-only video card placeholder */
.transcript-icon-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-secondary);
    min-height: 80px;
    background: var(--hover-color);
    border-radius: 8px;
}

.transcript-icon-placeholder svg {
    margin-bottom: 8px;
    opacity: 0.6;
}

.transcript-icon-placeholder .transcript-card-label {
    font-size: 0.85rem;
}

.upload-divider-vertical {
    width: 2px;
    height: 66%;
    background: var(--border-color);
    align-self: center;
    flex-shrink: 0;
}

/* On narrow screens, stack vertically */
@media (max-width: 600px) {
    .upload-area {
        flex-direction: column;
    }

    .upload-divider-vertical {
        width: 66%;
        height: 2px;
        margin: 10px 0;
    }
}

.drive-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #4285f4;
}

.files-section, .prompt-section, .tweets-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary-color);
}

.files-section h2, .prompt-section h2, .tweets-section h2, .refine-section h2, .refined-section h2 {
    margin-bottom: 20px;
    color: var(--accent-color);
}

.tweets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tweets-header h2 {
    margin-bottom: 0;
}

.tweets-footer {
    margin-top: 30px;
    padding: 20px;
    border-top: 2px solid var(--border-color);
    background: #f7f9fa;
    border-radius: 8px;
}

.refine-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.refine-header h2 {
    margin: 0;
    color: var(--accent-color);
}

.refined-tweets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.refined-tweets-header h2 {
    margin: 0;
}

#manageRefinementsBtn {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    padding: 6px 12px;
    color: var(--primary-color);
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
}

#manageRefinementsBtn:hover {
    background: rgba(29, 161, 242, 0.1);
    border-radius: 4px;
}

.refining-indicator {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 500;
}

.refining-indicator .dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

.refine-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);  /* Equal columns for 3 buttons */
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
}

.refine-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    gap: 8px;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 100px;  /* Ensure equal height */
}

.settings-icon-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.4;
    transition: all 0.2s ease;
    z-index: 10;
    color: var(--text-secondary);
}

.refine-action-btn:hover .settings-icon-btn {
    opacity: 0.7;
}

.settings-icon-btn:hover {
    opacity: 1 !important;
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.settings-icon-btn svg {
    display: block;
}

.refine-action-btn .btn-label {
    font-size: 1rem;
    font-weight: 600;
}

.refine-action-btn .btn-description {
    font-size: 0.8rem;
    opacity: 0.8;
    line-height: 1.3;
}

.refine-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 161, 242, 0.3);
}

#refinedTweetsSection {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 3px solid var(--accent-color);
    background: linear-gradient(to bottom, rgba(30, 201, 225, 0.05) 0%, rgba(255, 138, 30, 0.05) 100%);
    padding: 30px;
    border-radius: 12px;
}

.refined-tweets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.refined-tweets-header h3 {
    color: var(--accent-color);
    font-size: 1.5rem;
    margin: 0;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.selected-tweets-display {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 2px solid var(--primary-color);
}

.selected-tweets-display h4 {
    margin: 0 0 15px 0;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.selected-tweets-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.selected-tweet-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    background: #f7f9fa;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.selected-tweet-number {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.selected-tweet-text {
    flex: 1;
    line-height: 1.5;
    color: var(--text-color);
}

#filesList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.video-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 3px solid transparent;
    cursor: pointer;
}

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

.video-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(29, 161, 242, 0.3);
}

.video-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f7f9fa;
    border-bottom: 1px solid var(--border-color);
}

.video-header .video-name {
    font-weight: 600;
    color: var(--text-color);
    word-break: break-word;
    flex: 1;
    margin: 0;
}

.delete-video-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: 10px;
}

.delete-video-btn:hover {
    background: #fee;
    color: #e0245e;
}

.delete-video-btn svg {
    display: block;
}

.video-thumbnail {
    width: 100%;
    background: black;
    aspect-ratio: 16 / 9;
    position: relative;
}

.video-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.drive-icon-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.drive-icon-placeholder .drive-logo-spinner {
    margin-bottom: 15px;
    animation: slow-spin 3s linear infinite;
}

@keyframes slow-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.drive-icon-placeholder .drive-file-name {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    text-align: center;
    padding: 0 15px;
    word-break: break-word;
}

.youtube-icon-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.youtube-icon-placeholder .youtube-logo-spinner {
    margin-bottom: 15px;
    animation: youtube-pulse 2s ease-in-out infinite;
}

@keyframes youtube-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

.youtube-icon-placeholder .youtube-file-name {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    text-align: center;
    padding: 0 15px;
    word-break: break-word;
}

.video-info {
    padding: 15px;
}

.video-name {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--secondary-color);
    word-break: break-word;
}

.video-status {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.video-status.processing {
    color: var(--primary-color);
}

.video-status.completed {
    color: var(--success-color);
}

.video-status.error {
    color: #e0245e;
}

.retry-btn {
    margin-left: 8px;
    padding: 2px 10px;
    background: #e0245e;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.retry-btn:hover {
    background: #c81e50;
}

.transcript-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.transcript-toggle {
    background: var(--hover-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.transcript-toggle:hover {
    background: var(--border-color);
}

.toggle-icon {
    display: inline-block;
    font-size: 0.8rem;
}

.transcript-content {
    display: none;
    margin-top: 10px;
    padding: 12px;
    background: var(--hover-color);
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.8;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.speaker-label {
    display: block;
    margin-top: 10px;
    font-weight: 600;
}

.speaker-justin {
    color: #1da1f2;
    font-weight: 600;
}

.speaker-betsey {
    color: #17bf63;
    font-weight: 600;
}

.speaker-interviewer {
    color: #e0245e;
    font-weight: 600;
}

.speaker-guest {
    color: #794bc4;
    font-weight: 600;
}

.speaker-person {
    color: #f45d22;
    font-weight: 600;
}

.speaker-unknown {
    color: #657786;
    font-style: italic;
}

/* Deleted segment ellipsis in transcript */
.segment-ellipsis {
    color: #999;
    cursor: help;
    font-style: italic;
    border-bottom: 1px dotted #ccc;
}

/* Speaker Timeline */
.timeline-container {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.timeline-duration {
    font-weight: 400;
    font-size: 0.8rem;
}

.timeline-bar {
    position: relative;
    height: 36px;
    background: #e8ecef;
    border-radius: 6px;
    overflow: hidden;
    margin: 8px 0;
    cursor: pointer;
}

.timeline-chunk {
    position: absolute;
    top: 2px;
    height: calc(100% - 4px);
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.15s, box-shadow 0.15s;
    min-width: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.timeline-chunk:hover {
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

.timeline-chunk-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    padding: 0 4px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.timeline-chunk-deleted {
    opacity: 0.25;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 3px,
        rgba(0, 0, 0, 0.15) 3px,
        rgba(0, 0, 0, 0.15) 6px
    ) !important;
}

.timeline-chunk-deleted:hover {
    opacity: 0.45;
}

.timeline-chunk-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

.timeline-chunk:hover .timeline-chunk-tooltip {
    display: block;
}

.timeline-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    margin-top: 6px;
    color: var(--text-secondary);
}

.timeline-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.timeline-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.timeline-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.timeline-edit-info {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 500;
    flex: 1;
}

.timeline-actions .btn {
    font-size: 0.8rem;
    padding: 5px 14px;
}

.timeline-actions .btn:disabled {
    background: #aaa;
    border-color: #aaa;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Video trim overlay */
.video-trim-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 10;
    border-radius: 8px;
}

.video-trim-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.view-tweets-btn {
    margin-top: 15px;
    width: 100%;
    padding: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-tweets-btn:hover {
    background: #1a91da;
}

.prompt-help {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

#promptEditor {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 15px;
}

#promptEditor:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: #e67a15;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 138, 30, 0.3);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #1f3538;
    transform: translateY(-1px);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-danger {
    background-color: #e0245e;
    color: white;
}

.btn-danger:hover {
    background-color: #c91c50;
}

.tweet-categories {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--tertiary-yellow);
}

.category-header h3 {
    color: var(--secondary-color);
    font-size: 1.3rem;
    margin: 0;
}

.btn-more {
    font-size: 0.8rem;
    padding: 3px 10px;
    background: var(--light-gray);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-more:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-more:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-more.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Batch separator between successive "More of these" batches */
.batch-separator {
    grid-column: 1 / -1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
    margin: 6px 0;
}

/* Placeholder skeleton cards shown while generating */
.placeholder-card {
    padding: 16px !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
}

.placeholder-shimmer {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #eee 25%, #ddd 50%, #eee 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.placeholder-shimmer.short {
    width: 60%;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.tweet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    /* Ensure maximum 4 cards per row */
    max-width: 100%;
}

/* Force max 4 columns on large screens */
@media (min-width: 1200px) {
    .tweet-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 900px) and (max-width: 1199px) {
    .tweet-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 600px) and (max-width: 899px) {
    .tweet-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.tweet-card {
    background: var(--hover-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    padding-top: 35px;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tweet-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(29, 161, 242, 0.2);
}

.tweet-card:hover .copy-icon {
    opacity: 1;
}

.tweet-card:hover .tweet-select-indicator {
    opacity: 0.3;
}

.tweet-card.selected {
    background: #e8f5fe;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(29, 161, 242, 0.1);
}

.tweet-card.selected .tweet-select-indicator {
    opacity: 1 !important;
}

.tweet-select-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.tweet-select-indicator svg {
    width: 14px;
    height: 14px;
}

.tweet-content {
    min-height: 60px;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    margin-bottom: 6px;
    word-wrap: break-word;
    white-space: pre-wrap;
    cursor: text;
}

.tweet-content:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.tweet-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.char-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.char-count.warning {
    color: #ff6b00;
}

.char-count.error {
    color: #e0245e;
}

.copy-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.copy-icon:hover {
    background: #1a91da;
    transform: scale(1.15);
}

.copy-icon svg {
    width: 16px;
    height: 16px;
}

.copy-icon.copied {
    background: var(--success-color);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 1.2rem;
}

/* Personality Section */
.personality-section {
    background: white;
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--accent-color);
}

.personality-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.user-toggle {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.user-toggle-btn {
    padding: 8px 24px;
    border: none;
    background: white;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-toggle-btn:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.user-toggle-btn.active {
    background: var(--primary-color);
    color: white;
}

.user-toggle-btn:hover:not(.active) {
    background: var(--hover-color);
}

.settings-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: var(--hover-color);
    color: var(--text-color);
}

/* Post counts - all three on one row */
.post-counts-row {
    display: flex;
    gap: 24px;
    align-items: center;
}

.count-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.count-group label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 80px;
}

.count-input {
    width: 45px;
    padding: 4px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
    font-weight: 500;
}

.count-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.count-group input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    cursor: pointer;
    min-width: 60px;
}

.count-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.count-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

/* Settings modal model selector */
#settingsModal .form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
}

#settingsModal .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-content.modal-large {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 3px solid var(--primary-color);
    background: linear-gradient(to right, rgba(30, 201, 225, 0.05), rgba(91, 51, 231, 0.05));
}

.modal-header h2 {
    margin: 0;
    color: var(--accent-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--hover-color);
    color: var(--secondary-color);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 30px;
    border-top: 2px solid var(--border-color);
}

.refinement-type-display {
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
}

.prompt-help {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 5px 0;
    line-height: 1.5;
}

.prompt-help code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #d63384;
}

/* Refinement Management Styles */
.refinement-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.refinement-list-header p {
    margin: 0;
    color: var(--text-secondary);
}

.refinement-management-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.refinement-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.refinement-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(29, 161, 242, 0.1);
}

.refinement-item-info {
    flex: 1;
}

.refinement-item-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin-bottom: 4px;
}

.refinement-item-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.refinement-item-id {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.refinement-item-actions {
    display: flex;
    gap: 8px;
}

.refinement-item-actions button {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

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

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 400px;
    font-weight: 500;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid #10b981;
    color: #047857;
}

.notification-error {
    border-left: 4px solid #ef4444;
    color: #b91c1c;
}

.notification-info {
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

/* ===== Post to Social Media Section ===== */
.post-to-social-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--tertiary-purple);
}

.post-social-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.post-social-header h2 {
    margin: 0;
    color: var(--tertiary-purple);
}


.platypus-poster-frame {
    width: 100%;
    min-height: 700px;
    border: none;
    border-radius: 8px;
}

/* Post this tweet button on tweet cards */
.post-this-btn {
    position: absolute;
    top: 8px;
    right: 48px;
    width: 34px;
    height: 34px;
    background: var(--tertiary-purple);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 10;
    border: none;
    padding: 0;
}

.post-this-btn:hover {
    background: #4a21c0;
    transform: scale(1.15);
}

.tweet-card:hover .post-this-btn {
    opacity: 1;
}

.post-this-btn svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 768px) {
    #filesList {
        grid-template-columns: 1fr;
    }

    .tweet-grid {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2rem;
    }

    .post-counts-row {
        flex-direction: column;
        gap: 12px;
    }

    .count-group {
        width: 100%;
    }

    .modal-content {
        width: 95%;
    }

    .notification {
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
}
