/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Accessibility helpers */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

:root {
    --primary-bg: #faf9f7;
    --secondary-bg: #f5f3ff;
    --accent-color: #8b5cf6;
    --accent-light: #a78bfa;
    --text-primary: #374151;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-large: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
    --border-radius-small: 8px;
    --transition: all 0.5s ease;
}

/* Theme backgrounds for different genres */
body.theme-inspirational {
    background: linear-gradient(135deg, #faf9f7 0%, #f5f3ff 100%);
}

body.theme-love {
    background: linear-gradient(135deg, #fef2f2 0%, #fce7f3 100%);
    --accent-color: #ec4899;
    --accent-light: #f472b6;
}

body.theme-life {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    --accent-color: #10b981;
    --accent-light: #34d399;
}

body.theme-humor {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    --accent-color: #f59e0b;
    --accent-light: #fbbf24;
}

body.theme-success {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    --accent-color: #3b82f6;
    --accent-light: #60a5fa;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--accent-color);
    letter-spacing: -0.025em;
}

.sign-in {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-small);
    transition: var(--transition);
}

.sign-in:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-color);
}

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

.user-avatar-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar-btn:hover {
    background: rgba(139, 92, 246, 0.1);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
}

.user-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    min-width: 180px;
    z-index: 1000;
    display: none;
    animation: dropdownSlideIn 0.2s ease-out;
}

.user-menu:hover .user-dropdown {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.user-dropdown a:last-child {
    border-bottom: none;
}

.user-dropdown a:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-color);
}

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

/* Main content */
.main {
    flex: 1;
    padding: 3rem 0;
}

.quote-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Genre selector */
.genre-selector {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-medium);
    text-align: center;
    max-width: 400px;
    width: 100%;
    margin-bottom: 1rem;
}

.genre-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.genre-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.genre-select:focus {
    outline: none;
    border-color: var(--accent-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.genre-select:hover {
    border-color: var(--accent-light);
}

/* Quote card */
.quote-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    box-shadow: var(--shadow-large);
    text-align: center;
    max-width: 600px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.quote-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
}

.quote-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-style: normal;
    position: relative;
}

.quote-text::before,
.quote-text::after {
    content: '"';
    font-size: 2rem;
    color: var(--accent-light);
    position: absolute;
    opacity: 0.3;
}

.quote-text::before {
    top: -0.5rem;
    left: -1rem;
}

.quote-text::after {
    bottom: -1rem;
    right: -1rem;
}

.quote-author {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-style: normal;
}

/* Social share */
.social-share {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.share-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
}

.share-btn:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-light);
    text-decoration: none;
    text-align: center;
    justify-content: center;
}

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

.btn-primary:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.btn-like {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    position: relative;
}

.btn-like:hover {
    background: rgba(255, 240, 245, 0.9);
    border-color: #f472b6;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.btn-like.liked {
    background: rgba(255, 240, 245, 0.9);
    border-color: #f472b6;
    color: #ec4899;
}

.heart {
    font-size: 1.2rem;
    transition: var(--transition);
}

.btn-like.liked .heart {
    animation: heartBeat 0.6s ease-in-out;
}

.like-count {
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.25rem;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(1); }
    75% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Reflection section */
.reflection-section {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-large);
    max-width: 600px;
    width: 100%;
}

.reflection-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.reflection-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.8);
    resize: vertical;
    min-height: 120px;
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.reflection-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.reflection-input::placeholder {
    color: var(--text-muted);
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .main {
        padding: 2rem 0;
    }
    
    .quote-card {
        padding: 2rem 1.5rem;
        margin: 0 16px;
    }
    
    .quote-text {
        font-size: 1.25rem;
    }
    
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .reflection-section {
        margin: 0 16px;
        padding: 1.5rem;
    }
    
    .social-share {
        margin: 0 16px;
    }
}

@media (max-width: 480px) {
    .quote-text {
        font-size: 1.1rem;
    }
    
    .quote-card {
        padding: 1.5rem 1rem;
    }
    
    .reflection-section {
        padding: 1rem;
    }
    
    .action-buttons {
        gap: 0.75rem;
    }
    
    .share-btn {
        width: 40px;
        height: 40px;
    }
}

/* Loading states and animations */
.quote-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.quote-text.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.quote-author.fade-in {
    animation: fadeIn 0.6s ease-out 0.2s both;
}

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

/* Success message for saved reflections */
.success-message {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-small);
    margin-top: 1rem;
    border: 1px solid rgba(16, 185, 129, 0.2);
    display: none;
}

.success-message.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

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