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

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --accent-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f2 50%, #f0f4f8 100%);
    min-height: 100vh;
    padding-bottom: 0;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Navigation - Modern Glass Effect */
.top-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 18px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 22px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

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

.nav-link {
    padding: 10px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 14px;
    position: relative;
}

.nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.nav-link.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-user {
    position: relative;
}

.nav-user .user-button {
    padding: 10px 20px;
    background: var(--secondary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
}

.nav-user .user-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Welcome Section - Modern Hero */
.welcome-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 40px 20px;
}

.welcome-content {
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.welcome-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    animation: fadeInUp 0.6s ease-out;
}

.welcome-title {
    font-size: 38px;
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.1;
    color: var(--text-primary);
    letter-spacing: -1.5px;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 20px;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.welcome-features {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

.feature-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-primary);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.feature-card:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* Container - Modern Card */
.container {
    max-width: 1400px;
    margin: 0 auto 30px;
    background: var(--bg-primary);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(229, 231, 235, 0.5);
    padding: 24px;
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--bg-tertiary);
}

.header-left {
    flex: 1;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.section-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

.header-right {
    display: flex;
    align-items: center;
}

.language-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.language-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.language-dropdown {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: var(--bg-primary);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.language-dropdown:hover {
    background: var(--bg-tertiary);
}

/* Tone Grid - Modern Cards */
.tone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.tone-btn {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.tone-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s;
}

.tone-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tone-btn:hover::before {
    opacity: 0.05;
}

.tone-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.tone-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-sm);
}

.tone-label {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 600;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* Text Areas - Modern Design */
.text-areas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.text-section {
    position: relative;
}

.text-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.text-section-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.char-count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.copy-icon-btn {
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    display: none;
    align-items: center;
    justify-content: center;
}

.copy-icon-btn:hover {
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

.textarea-wrapper {
    position: relative;
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

textarea::placeholder {
    color: var(--text-muted);
}

textarea[readonly] {
    background-color: var(--bg-secondary);
    cursor: default;
}

textarea.streaming {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Loading State */
.loading {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 24px 32px;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    font-size: 15px;
    color: #667eea;
    font-weight: 600;
    z-index: 10;
    align-items: center;
    gap: 12px;
}

.loading.show {
    display: flex;
    animation: fadeInScale 0.3s ease-out;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Action Buttons - Modern */
.action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
    transform: translateY(-2px);
}

/* User Menu Styles */
.user-menu {
    position: relative;
}

.user-button {
    padding: 10px 20px;
    background: var(--secondary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
}

.user-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    min-width: 220px;
    display: none;
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown.show {
    display: block;
    animation: fadeInScale 0.2s ease-out;
}

.dropdown-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.dropdown-header p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.dropdown-item {
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
}

/* Footer - Modern */
.footer {
    background: transparent;
    color: var(--text-muted);
    text-align: center;
    padding: 50px 30px;
    margin-top: 80px;
    border-top: 1px solid var(--border-color);
}

.footer p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 32px;
    }
    
    .welcome-title {
        font-size: 48px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 16px 24px;
    }
    
    .nav-links {
        gap: 4px;
    }
    
    .nav-link {
        padding: 8px 12px;
        font-size: 13px;
    }

    .welcome-section {
        padding: 40px 24px 30px;
    }
    
    .welcome-title {
        font-size: 36px;
    }
    
    .welcome-subtitle {
        font-size: 17px;
    }
    
    .welcome-features {
        gap: 12px;
    }
    
    .feature-card {
        padding: 12px 18px;
        font-size: 13px;
    }

    .container {
        padding: 24px;
        border-radius: 20px;
    }

    .section-header {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }

    .section-title {
        font-size: 24px;
    }

    .header-right {
        width: 100%;
    }
    
    .language-selector-wrapper {
        width: 100%;
        justify-content: space-between;
    }

    .tone-grid {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 12px;
    }
    
    .tone-btn {
        padding: 16px 12px;
    }
    
    .tone-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .text-areas {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    textarea {
        min-height: 240px;
    }

    .action-buttons {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .welcome-title {
        font-size: 28px;
    }

    .tone-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Footer Enhancement */
.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    margin-top: 80px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.footer-content p {
    margin: 0;
    font-size: 14px;
}

.footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    opacity: 0.9;
}

.footer-links a:hover {
    opacity: 1;
    transform: translateY(-2px);
}
