/* ====================================
   EGLE TEXT EDITOR PRO - ULTIMATE CSS
   Glass Morphism + AI Chatbot Design
   ==================================== */

:root {
    --background-color: #0a0e27;
    --editor-bg: #1a1f3a;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --toolbar-bg: rgba(26, 31, 58, 0.7);
    --toolbar-border: #2d3458;
    --button-bg: rgba(51, 65, 85, 0.6);
    --button-hover-bg: rgba(71, 85, 105, 0.8);
    --panel-bg: rgba(26, 31, 58, 0.95);
    --panel-border: rgba(76, 110, 245, 0.3);
    --primary-color: #4c6ef5;
    --primary-glow: rgba(76, 110, 245, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 30px var(--primary-glow);
}

/* ==================== RESET ==================== */
* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f1729 100%);
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Arka plan animasyonu */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(76, 110, 245, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ==================== VIEW CONTROL ==================== */
.view {
    display: none !important;
}

.active-view {
    display: block !important;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ==================== GLASS MORPHISM TOOLBAR ==================== */
.toolbar {
    height: auto;
    min-height: 70px;
    padding: 15px 30px;
    background: var(--toolbar-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 15px;
}

.controls, .action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==================== BUTTONS - GLASS EFFECT ==================== */
button, select, input[type="text"] {
    height: 42px;
    padding: 0 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

button:hover {
    background: var(--button-hover-bg);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

button:active {
    transform: translateY(0);
}

/* AI Button Özel Stil */
.ai-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    font-weight: 700;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(118, 75, 162, 0.4); }
    50% { box-shadow: 0 0 40px rgba(118, 75, 162, 0.8); }
}

/* ==================== DOCUMENT TITLE INPUT ==================== */
#document-title-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    font-weight: 700;
    font-size: 16px;
    width: clamp(200px, 25vw, 400px);
    outline: none;
    transition: all 0.3s ease;
}

#document-title-input:focus {
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 20px var(--primary-glow);
    width: clamp(250px, 35vw, 500px);
}

/* ==================== COLOR PICKER ==================== */
#text-color-picker {
    width: 50px;
    height: 42px;
    padding: 5px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid var(--glass-border);
    background: var(--glass-bg);
}

#text-color-picker::-webkit-color-swatch {
    border-radius: 4px;
    border: none;
}

/* ==================== EDITOR - GLASS PAPER ==================== */
.document-editor {
    width: 95%;
    max-width: 900px;
    min-height: 1100px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    margin: 50px auto;
    padding: clamp(40px, 8vw, 100px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl), 0 0 50px rgba(76, 110, 245, 0.1);
    outline: none;
    line-height: 1.9;
    word-break: break-word;
    caret-color: var(--primary-color);
    transition: all 0.3s ease;
}

.document-editor:focus {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

/* ==================== AI CHATBOT PANEL ==================== */
.ai-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ai-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ai-panel {
    position: fixed;
    right: -450px;
    top: 0;
    width: 450px;
    height: 100vh;
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%);
    backdrop-filter: blur(30px);
    border-left: 1px solid var(--glass-border);
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-panel.active {
    right: 0;
}

.ai-header {
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.ai-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: white;
}

.ai-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 18px;
}

.ai-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* DİL SEÇİCİ BAR */
.ai-language-bar {
    padding: 20px 25px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 15px;
}

.ai-language-bar label {
    color: var(--text-color);
    font-weight: 600;
    font-size: 14px;
}

#ai-language-selector {
    flex: 1;
    height: 38px;
    padding: 0 15px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

#ai-language-selector:hover {
    border-color: var(--primary-color);
    background: var(--button-hover-bg);
}

#ai-language-selector:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-glow);
}

.ai-messages {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-message {
    padding: 15px 20px;
    border-radius: var(--radius-md);
    max-width: 85%;
    animation: messageSlide 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

@keyframes messageSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    background: linear-gradient(135deg, #4c6ef5 0%, #667eea 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-message {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.ai-wiki-result {
    background: rgba(76, 110, 245, 0.05);
    padding: 15px;
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-sm);
    margin-top: 10px;
}

.ai-wiki-result h3 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 18px;
}

.ai-wiki-result p {
    margin: 0 0 15px 0;
    line-height: 1.7;
}

.wiki-meta {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 10px;
    border-top: 1px solid var(--glass-border);
}

.wiki-meta a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.wiki-meta a:hover {
    color: #667eea;
    text-decoration: underline;
}

.wiki-meta small {
    color: var(--text-muted);
    font-size: 12px;
}

.ai-input-container {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 10px;
}

#ai-input {
    flex: 1;
    height: 50px;
    padding: 0 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    color: var(--text-color);
    outline: none;
    transition: all 0.3s ease;
}

#ai-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px var(--primary-glow);
}

.ai-send-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 20px;
}

.ai-send-btn:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 0 30px rgba(118, 75, 162, 0.6);
}

/* ==================== MODAL PANELS ==================== */
.modal-panel, .settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    background: var(--panel-bg);
    backdrop-filter: blur(30px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 35px;
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    z-index: 2000;
    overflow-y: auto;
    display: none;
}

.modal-panel h2, .settings-panel h2 {
    margin: 0 0 25px 0;
    font-size: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-weight: 600;
}

.setting-group input {
    width: 100%;
    height: 45px;
}

.setting-group small {
    color: var(--text-muted);
    font-size: 12px;
}

/* ==================== DASHBOARD ==================== */
.dashboard-header {
    padding: 40px;
    text-align: center;
    background: linear-gradient(135deg, rgba(76, 110, 245, 0.1) 0%, transparent 100%);
}

.dashboard-header h1 {
    margin: 0 0 10px 0;
    font-size: clamp(28px, 5vw, 48px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    padding: 50px;
    max-width: 1600px;
    margin: 0 auto;
}

.document-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 30px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.document-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.document-card:hover::before {
    transform: scaleX(1);
}

.document-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.document-card h3 {
    margin: 0 0 15px 0;
    font-size: 22px;
    color: var(--primary-color);
}

.document-card p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    background-clip: padding-box;
}

/* ==================== TABLE STYLES ==================== */
.document-editor table {
    border-collapse: collapse;
    width: 100%;
    margin: 20px 0;
    background: var(--glass-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.document-editor table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    font-weight: 700;
}

.document-editor table td {
    padding: 12px;
    border: 1px solid var(--glass-border);
}

.document-editor img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 20px 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .toolbar {
        justify-content: center;
        padding: 15px;
    }
    
    .document-editor {
        width: 100%;
        margin: 0;
        padding: 25px 15px;
        border-radius: 0;
    }
    
    .ai-panel {
        width: 100%;
        right: -100%;
    }
    
    .document-grid {
        grid-template-columns: 1fr;
        padding: 20px;
    }
}

/* ==================== SEPARATOR ==================== */
.separator {
    color: var(--text-muted);
    margin: 0 5px;
}

/* ==================== DÖKÜMAN İSTATİSTİKLERİ ==================== */
.doc-stats {
    padding: 12px 30px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    position: sticky;
    top: 70px;
    z-index: 999;
    backdrop-filter: blur(10px);
}

.doc-stats strong {
    color: var(--primary-color);
    font-weight: 700;
}