/* Main CSS - Layout and Structure */

/* Thumbnail Preview */
.thumbnail-preview {
    position: relative;
    width: 120px;
    height: 68px;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 12px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.thumbnail-preview:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(229, 57, 53, 0.3);
}

.thumbnail-preview.hidden {
    display: none;
}

.thumbnail-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.thumbnail-preview:hover .thumbnail-overlay {
    opacity: 1;
}

.thumbnail-overlay svg {
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.thumbnail-preview-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.thumbnail-label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

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

:root {
    --bg-primary: #FAFAFA;
    --bg-secondary: #F5F5F5;
    --accent-primary: #E53935;
    --accent-hover: #C62828;
    --accent-light: rgba(229, 57, 53, 0.2);
    --text-primary: #212121;
    --text-secondary: #757575;
    --text-light: #9E9E9E;
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Gradient */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: linear-gradient(135deg, #FAFAFA 0%, #F5F5F5 100%);
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(229, 57, 53, 0.15) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    animation: float 20s ease-in-out infinite;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(229, 57, 53, 0.1) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    animation: float 25s ease-in-out infinite reverse;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(229, 57, 53, 0.08) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, 30px); }
}

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

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 24px;
    background: rgba(250, 250, 250, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 18px;
}

.logo svg {
    transition: var(--transition);
}

.logo:hover svg {
    transform: scale(1.1);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.usage-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--glass-bg);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.usage-label {
    color: var(--text-secondary);
}

.usage-count {
    color: var(--accent-primary);
    font-weight: 500;
}

/* Main Content */
.main-content {
    padding-top: 80px;
    min-height: calc(100vh - 80px);
}

/* Hero Section */
.hero {
    padding: 60px 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.hero-content {
    max-width: 700px;
    width: 100%;
    text-align: center;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.title-accent {
    color: var(--accent-primary);
    position: relative;
}

.title-accent::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 0;
    width: 100%;
    height: 8px;
    background: var(--accent-light);
    z-index: -1;
    border-radius: 4px;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.6;
}

/* Input Container */
.input-container {
    padding: 32px;
}

.summarize-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.input-wrapper {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

.glass-input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: var(--transition);
}

.glass-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.glass-input::placeholder {
    color: var(--text-light);
}

.glass-button {
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(229, 57, 53, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.glass-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 57, 53, 0.4);
}

.glass-button:active {
    transform: translateY(0);
}

.glass-button:disabled {
    background: #BDBDBD;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-loading {
    display: none;
}

.glass-button.loading .btn-text {
    display: none;
}

.glass-button.loading .btn-loading {
    display: flex;
    align-items: center;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

/* Error Message */
.error-message {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(229, 57, 53, 0.1);
    border: 1px solid rgba(229, 57, 53, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-primary);
    font-size: 14px;
    text-align: left;
}

.error-message.hidden {
    display: none;
}

/* Loading Container */
.loading-container {
    margin-top: 32px;
    padding: 40px;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(229, 57, 53, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner.small {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

.loading-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.loading-subtext {
    font-size: 14px;
    color: var(--text-secondary);
}

.loading-container.hidden {
    display: none;
}

/* Result Section */
.result-section {
    padding: 40px 24px;
    animation: fadeIn 0.5s ease;
}

.result-section.hidden {
    display: none;
}

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

.result-container {
    max-width: 800px;
    margin: 0 auto;
}

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

.result-header h2 {
    font-size: 24px;
    font-weight: 600;
}

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

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: var(--text-primary);
}

/* Summary Content */
.summary-content {
    padding: 32px;
    margin-bottom: 32px;
    line-height: 1.8;
}

.summary-content h2 {
    font-size: 20px;
    color: var(--accent-primary);
    margin: 24px 0 12px;
}

.summary-content h2:first-child {
    margin-top: 0;
}

.summary-content h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin: 20px 0 12px;
}

.summary-content p {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.summary-content ul, .summary-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.summary-content li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.summary-content strong {
    color: var(--text-primary);
}

/* Chat Section */
.chat-section {
    margin-top: 32px;
}

.chat-header {
    margin-bottom: 16px;
}

.chat-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.chat-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.chat-container {
    padding: 24px;
}

.chat-messages {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.chat-message {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    max-width: 85%;
}

.chat-message.user {
    background: var(--accent-light);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    background: rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 4px;
}

.chat-message p {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0;
}

.chat-form {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px !important;
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.chat-send-btn:hover {
    background: var(--accent-hover);
}

.chat-send-btn:disabled {
    background: #BDBDBD;
    cursor: not-allowed;
}

.chat-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.chat-loading.hidden {
    display: none;
}

/* Features Section */
.features {
    padding: 60px 24px;
    background: var(--bg-secondary);
}

.features-grid {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.feature-card {
    padding: 32px;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
}

.feature-icon {
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Footer */
.footer {
    padding: 24px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    background: var(--bg-secondary);
}

/* Thumbnail Promo Section */
.thumbnail-promo {
    padding: 40px 24px;
    max-width: 800px;
    margin: 0 auto;
}

.promo-container {
    padding: 32px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

.promo-content {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.promo-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(229, 57, 53, 0.1);
    border-radius: 12px;
}

.promo-text h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.promo-text p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.promo-text strong {
    color: var(--text-primary);
    font-weight: 500;
}

.promo-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #E53935;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.promo-link:hover {
    color: #ff5252;
    gap: 12px;
}

.promo-link svg {
    transition: transform 0.2s ease;
}

.promo-link:hover svg {
    transform: translate(2px, -2px);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 32px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .summarize-form {
        flex-direction: column;
    }
    
    .input-wrapper {
        min-width: 100%;
    }
    
    .glass-button {
        width: 100%;
        justify-content: center;
    }
    
    .result-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .usage-indicator {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .promo-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .promo-icon {
        width: 48px;
        height: 48px;
    }
}
