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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #ec4899;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --background: #f9fafb;
    --card-background: #ffffff;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-color);
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.header-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-generate {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-generate:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.btn-quick {
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: pulse 2s ease-in-out infinite;
}

.btn-quick:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

/* Article Container */
.article-container {
    flex: 1;
    padding: 2rem 1.5rem;
    overflow-y: auto;
    position: relative;
}

.article-card {
    background: var(--card-background);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    min-height: 500px;
    transition: transform 0.3s ease;
    position: relative;
}

.article-content {
    height: 100%;
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    gap: 1rem;
    color: var(--text-light);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Article Body */
.article-body {
    animation: fadeIn 0.5s ease;
}

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

.article-image-container {
    margin: -2rem -2rem 1.5rem -2rem;
    position: relative;
    overflow: hidden;
    border-radius: 24px 24px 0 0;
}

.article-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 400px;
}

.image-credit {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    padding: 1rem 1rem 0.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
}

.image-credit a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
}

.image-credit a:hover {
    text-decoration: underline;
}

.article-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.read-time {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ai-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.75rem;
}

.article-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.3;
    color: var(--text-color);
}

.article-text {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    white-space: pre-wrap;
}

.article-text p {
    margin-bottom: 1rem;
}

.article-definitions {
    background: linear-gradient(135deg, #f6f8ff 0%, #f0f4ff 100%);
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.definitions-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.definitions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.definition-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.definition-term {
    font-weight: 700;
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.definition-term::before {
    content: "•";
    color: var(--primary-color);
    font-size: 1.5rem;
    line-height: 1;
}

.definition-text {
    color: var(--text-light);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tag {
    background: var(--background);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.article-stats {
    display: flex;
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-weight: 500;
}

.stat svg {
    color: var(--text-light);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.btn-action {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: var(--card-background);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.btn-action:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.btn-action:active {
    transform: translateY(0) scale(0.95);
}

.btn-like {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-like.liked {
    animation: likeAnimation 0.5s ease;
}

@keyframes likeAnimation {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.btn-next {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-next-generate {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
    position: relative;
    animation: glow 2s ease-in-out infinite;
}

.btn-next-generate:hover {
    animation: none;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(250, 112, 154, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(250, 112, 154, 0.8);
    }
}

/* Swipe Indicator */
.swipe-indicator {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    animation: bounce 2s infinite;
    pointer-events: none;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-background);
    border-radius: 24px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-color);
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

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

/* Form */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.3s;
    font-family: inherit;
}

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

.btn-submit {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-submit:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .article-title {
        font-size: 1.5rem;
    }
    
    .article-text {
        font-size: 1rem;
    }
    
    .article-card {
        padding: 1.5rem;
    }
    
    .header {
        padding: 1rem;
    }
    
    .logo {
        font-size: 1.25rem;
    }
}

/* Swipe animations */
.swipe-up {
    animation: swipeUp 0.5s ease forwards;
}

@keyframes swipeUp {
    to {
        transform: translateY(-100vh);
        opacity: 0;
    }
}

.swipe-down {
    animation: swipeDown 0.5s ease forwards;
}

@keyframes swipeDown {
    to {
        transform: translateY(100vh);
        opacity: 0;
    }
}

