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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.upload-section {
    padding: 5px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.file-upload {
    position: relative;
    display: inline-block;
    margin: 10px 0;
}

.file-upload input[type="file"] {
    position: absolute;
    left: -9999px;
}

.file-upload label {
    display: inline-block;
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    border: none;
}

.file-upload label:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.file-upload button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.file-upload button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 180, 219, 0.3);
}

.file-upload button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.conversation-selector {
    padding: 30px 40px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.conversation-selector h3 {
    margin-bottom: 15px;
    color: #333;
}

.conversation-selector select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.conversation-selector select:focus {
    outline: none;
    border-color: #667eea;
}

.upload-method {
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: 10px;
    border: 2px dashed #ddd;
}

.upload-method h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.divider {
    margin: 30px 0;
    text-align: center;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
}

.divider span {
    background: #f8f9fa;
    padding: 0 20px;
    color: #666;
    font-weight: 500;
}

.cloud-options {
    margin-top: 15px;
}

.url-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.url-input-container input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.url-input-container input:focus {
    outline: none;
    border-color: #667eea;
}

.url-input-container button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.url-input-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 180, 219, 0.3);
}

.url-input-container button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Cloud Instructions Collapsible */
.cloud-instructions {
    background: #f0f8ff;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #00b4db;
}

.cloud-instructions p {
    margin-bottom: 10px;
    font-weight: 600;
    color: #0083b0;
}

.cloud-instructions ul {
    list-style: none;
    padding: 0;
}

.cloud-instructions li {
    margin: 8px 0;
    color: #555;
    font-size: 0.9rem;
}

.cloud-instructions {
    margin-top: 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
}

.cloud-instructions details {
    cursor: pointer;
}

.cloud-instructions summary {
    color: #495057;
    font-weight: 600;
    list-style: none;
    outline: none;
    user-select: none;
}

.cloud-instructions summary::-webkit-details-marker {
    display: none;
}

.cloud-instructions summary::before {
    content: '▶ ';
    display: inline-block;
    margin-right: 5px;
    transition: transform 0.2s;
}

.cloud-instructions details[open] summary::before {
    transform: rotate(90deg);
}

.cloud-instructions summary:hover {
    color: #0066cc;
}

.cloud-instructions-content {
    margin-top: 10px;
    padding-left: 10px;
}

.cloud-instructions-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.cloud-instructions-content li {
    margin: 8px 0;
    line-height: 1.5;
}

.sort-options {
    margin-bottom: 15px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
}

.sort-options label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.sort-options label:hover {
    background-color: #f0f0f0;
}

.sort-options input[type="radio"] {
    margin-right: 6px;
    accent-color: #667eea;
}

.chat-container {
    height: 600px;
    padding: 20px;
    overflow-y: auto;
    background: #f5f5f5;
}

.chat-message {
    display: flex;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease-in;
}

.chat-message.owner {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}

.message-bubble.owner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-right: 10px;
}

.message-bubble.other {
    background: white;
    color: #333;
    margin-left: 10px;
    border: 1px solid #e0e0e0;
}

.message-time {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 5px;
}

.message-sender {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 5px;
    opacity: 0.8;
}

.message-bubble img {
    max-width: 100%;
    border-radius: 8px;
    margin: 5px 0;
}

.no-data {
    text-align: center;
    color: #666;
    font-size: 1.1rem;
    padding: 50px;
}

.chat-info {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    color: #1976d2;
    font-weight: 500;
}

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

.hidden {
    display: none;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.google-auth-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    text-align: center;
}

.google-signin-button {
    background: #4285f4;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(66, 133, 244, 0.3);
}

.google-signin-button:hover {
    background: #3367d6;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(66, 133, 244, 0.4);
}

.google-signout-button {
    background: #ea4335;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(234, 67, 53, 0.3);
}

.google-signout-button:hover {
    background: #d33b2c;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(234, 67, 53, 0.4);
}

.status-success {
    color: #28a745;
    font-weight: 600;
    margin-top: 10px;
}

.status-warning {
    color: #ffc107;
    font-weight: 600;
    margin-top: 10px;
}

.status-error {
    color: #dc3545;
    font-weight: 600;
    margin-top: 10px;
}

.api-setup-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 12px;
    color: #856404;
    font-size: 0.9rem;
}

.api-setup-notice p {
    margin: 0 0 8px 0;
}

.api-setup-notice ol {
    margin: 8px 0 0 20px;
    padding: 0;
}

.quote-container {
    background: rgba(255, 255, 255, 0.1);
    border-left: 3px solid #667eea;
    margin: 8px 0;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.message-bubble.owner .quote-container {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: rgba(255, 255, 255, 0.6);
}

.message-bubble.other .quote-container {
    background: #f8f9fa;
    border-left-color: #667eea;
}

.quote-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.8rem;
}

.quote-author {
    font-weight: 600;
    color: #667eea;
}

.message-bubble.owner .quote-author {
    color: rgba(255, 255, 255, 0.9);
}

.quote-timestamp {
    opacity: 0.7;
    font-size: 0.75rem;
}

.quote-content {
    font-style: italic;
    line-height: 1.4;
    margin-bottom: 4px;
    opacity: 0.9;
}

.reply-content {
    margin-top: 8px;
    line-height: 1.5;
}

.message-text {
    line-height: 1.5;
}

/* Enhanced message bubble styling for quotes */
.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.4;
}

.message-bubble.owner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-right: 10px;
}

.message-bubble.other {
    background: white;
    color: #333;
    margin-left: 10px;
    border: 1px solid #e0e0e0;
}

.chat-image {
    max-width: 300px;
    max-height: 200px;
    border-radius: 8px;
    display: block;
    margin-top: 5px;
}

.image-meta {
    font-size: 0.8em;
    color: #666;
    margin-top: 3px;
}

.api-setup-notice li {
    margin: 4px 0;
}

.error-details {
    background: #ffebee;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #f44336;
    margin-top: 15px;
    font-size: 0.9rem;
    color: #c62828;
}

/* Instructions Section */
.instructions-section {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.instructions-section details {
    cursor: pointer;
}

.instructions-section summary {
    color: #2c3e50;
    font-size: 1.1em;
    font-weight: 600;
    list-style: none;
    outline: none;
    user-select: none;
}

.instructions-section summary::-webkit-details-marker {
    display: none;
}

.instructions-section summary::before {
    content: '▶ ';
    display: inline-block;
    margin-right: 5px;
    transition: transform 0.2s;
}

.instructions-section details[open] summary::before {
    transform: rotate(90deg);
}

.instructions-section summary:hover {
    color: #0066cc;
}

.instructions-content {
    color: #495057;
    margin-top: 15px;
    padding-left: 20px;
}

.instruction-step {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.instruction-step:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.instruction-step h4 {
    color: #495057;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.instruction-step p {
    margin: 8px 0;
    line-height: 1.6;
}

.instruction-step ul {
    margin: 8px 0;
    padding-left: 25px;
}

.instruction-step li {
    margin: 5px 0;
    line-height: 1.5;
}

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

.instruction-step a {
    color: #0066cc;
    text-decoration: none;
}

.instruction-step a:hover {
    text-decoration: underline;
}