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

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Auth Screen */
.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.logo h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: 10px;
    text-align: center;
}

.tagline {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 40px;
}

.auth-box {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.auth-box h2 {
    margin-bottom: 30px;
    color: var(--text-primary);
    text-align: center;
}

.auth-section {
    display: none;
}

.auth-section.active {
    display: block;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.gender-select {
    display: flex;
    gap: 15px;
}

.gender-option {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.gender-option:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.gender-option input[type="radio"] {
    display: none;
}

.gender-option input[type="radio"]:checked + span {
    color: var(--primary-color);
    font-weight: 600;
}

.gender-option span {
    font-size: 1.1rem;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    width: 100%;
}

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

/* Main Screen */
.main-container {
    min-height: 100vh;
    background: var(--bg-color);
}

.header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

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

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.1);
}

/* Navigation Tabs */
.nav-tabs {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-tab {
    padding: 12px 20px;
    background: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s;
    position: relative;
}

.nav-tab:hover {
    background: var(--primary-color);
    color: white;
}

.nav-tab.active {
    background: var(--primary-color);
    color: white;
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Content */
.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Write Tab */
.write-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 0 auto;
}

.write-container h2 {
    margin-bottom: 10px;
}

.hint {
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

#letterContent {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

#letterContent:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

#charCount {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Notifications */
.notifications {
    margin-top: 20px;
}

.notification {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease-out;
}

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

.notification.success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.notification.info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--primary-color);
}

/* Letters List */
.letters-list {
    display: grid;
    gap: 15px;
}

.letter-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
    border-left: 4px solid var(--primary-color);
}

.letter-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.letter-card.unread {
    border-left-color: var(--danger-color);
    background: linear-gradient(to right, rgba(239, 68, 68, 0.05), white);
}

.letter-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.letter-status {
    display: flex;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.letter-preview {
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.letter-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1.1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease-out;
}

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

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
}

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

.reply-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.reply-section h3 {
    margin-bottom: 15px;
}

#replyContent {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 15px;
}

/* Chats */
.chats-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    height: calc(100vh - 200px);
}

.chats-sidebar {
    background: white;
    border-radius: 15px;
    padding: 20px;
    overflow-y: auto;
}

.chats-list {
    margin-top: 15px;
}

.chat-item {
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background 0.2s;
}

.chat-item:hover {
    background: var(--bg-color);
}

.chat-item.active {
    background: var(--primary-color);
    color: white;
}

.chat-area {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-window {
    display: none;
    flex-direction: column;
    height: 100%;
}

.chat-window.active {
    display: flex;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 15px;
    line-height: 1.5;
}

.message.sent {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 5px;
}

.message.received {
    align-self: flex-start;
    background: var(--bg-color);
    border-bottom-left-radius: 5px;
}

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

.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

#chatForm {
    display: flex;
    gap: 10px;
}

#chatInput {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 1rem;
}

#chatInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

#chatForm button {
    padding: 12px 20px;
    border-radius: 25px;
}

/* Responsive */
@media (max-width: 768px) {
    .chats-container {
        grid-template-columns: 1fr;
    }
    
    .chats-sidebar {
        display: none;
    }
    
    .nav-tabs {
        overflow-x: auto;
    }
    
    .auth-box {
        padding: 30px 20px;
    }
}
/* ============================================
   YENİ XÜSUSİYYƏTLƏR - Dark Mode & More
   ============================================ */

/* Dark Mode Variables */
body.dark-mode {
    --primary-color: #818cf8;
    --secondary-color: #a78bfa;
    --success-color: #34d399;
    --danger-color: #f87171;
    --warning-color: #fbbf24;
    --bg-color: #1e293b;
    --card-bg: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

body.dark-mode {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

body.dark-mode .main-container {
    background: var(--bg-color);
}

/* Smooth theme transition */
body, .main-container, .card, .header, .nav-tab, .btn, 
.form-group input, .form-group textarea, .letter-card {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Info Box */
.info-box {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.info-box strong {
    color: var(--primary-color);
}

/* Category Selector */
.category-selector {
    margin-bottom: 20px;
}

.category-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--text-secondary);
}

.categories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.category-option {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--card-bg);
}

.category-option:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.category-option input[type="radio"] {
    display: none;
}

.category-option input[type="radio"]:checked + span {
    color: var(--primary-color);
    font-weight: 600;
}

.category-option span {
    font-size: 1rem;
}

/* Icebreaker Section */
.icebreaker-section {
    margin-bottom: 20px;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

.icebreaker-text {
    margin-top: 15px;
    padding: 15px;
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    font-style: italic;
    color: var(--text-primary);
    display: none;
}

.icebreaker-text.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

/* Templates Section */
.templates-section {
    margin-bottom: 20px;
}

.templates-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.template-select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.3s;
}

.template-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Letter Card with Category Badge */
.letter-card {
    position: relative;
}

.category-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 4px 10px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Chat Header Enhancements */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.chat-actions {
    display: flex;
    gap: 10px;
}

/* Status Indicator */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    margin-left: 8px;
}

.status-indicator.online {
    background: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-style: italic;
    margin-left: 10px;
}

.typing-indicator.show {
    display: inline-block;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Message Reactions */
.message {
    position: relative;
}

.message-reactions {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.reaction {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.reaction:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: scale(1.1);
}

.reaction-emoji {
    font-size: 1rem;
}

.reaction-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.reaction-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    display: none;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px;
    gap: 5px;
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

.reaction-picker.show {
    display: flex;
}

.reaction-emoji-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.2s;
}

.reaction-emoji-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.2);
}

/* Message Animations */
.message.new {
    animation: messageSlideIn 0.3s ease-out;
}

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

/* Stats Modal */
.stats-container {
    padding: 20px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: var(--bg-color);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Badges Section */
.badges-section {
    margin-top: 40px;
}

.badges-section h3 {
    margin-bottom: 20px;
}

.badges-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.badge-item {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s;
    border: 2px solid var(--border-color);
}

.badge-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
}

.badge-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.badge-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* New Letter Animation */
@keyframes letterArrival {
    0% {
        opacity: 0;
        transform: translateY(-50px) rotate(-5deg);
    }
    50% {
        transform: translateY(10px) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(0);
    }
}

.letter-card.new-arrival {
    animation: letterArrival 0.6s ease-out;
}

/* Notification Animation */
.notification {
    animation: notificationSlide 0.4s ease-out;
}

@keyframes notificationSlide {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Button Hover Effects */
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

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

/* Report Form */
#reportForm .form-group {
    margin-bottom: 20px;
}

#reportForm select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
}

#reportForm select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Chat Item with Online Status */
.chat-item {
    position: relative;
}

.chat-item::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.chat-item.online::before {
    background: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .categories {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .badges-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Loading State */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Success/Error States */
.success-message {
    padding: 15px;
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--success-color);
    border-radius: 8px;
    color: var(--success-color);
    margin: 15px 0;
    animation: slideDown 0.3s ease-out;
}

.error-message {
    padding: 15px;
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger-color);
    border-radius: 8px;
    color: var(--danger-color);
    margin: 15px 0;
    animation: slideDown 0.3s ease-out;
}

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

/* Smooth Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Dark mode scrollbar */
body.dark-mode ::-webkit-scrollbar-track {
    background: var(--card-bg);
}