/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
    background-color: #f5f5f5;
    min-height: 100vh;
}

/* Main layout */
.main-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 40px);
    width: 100%;
    min-height: 600px;
}

/* Chat container */
.chat-container {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    min-width: 300px;
}

.chat-container h1 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
    font-size: clamp(20px, 4vw, 28px);
    font-weight: 600;
}

/* Messages area */
.messages {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 20px;
    background-color: #fafafa;
    border-radius: 12px;
    scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.message {
    margin-bottom: 20px;
    padding: 15px 20px;
    border-radius: 20px;
    max-width: 85%;
    line-height: 1.6;
    font-size: clamp(14px, 2.5vw, 16px);
    word-wrap: break-word;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    text-align: right;
    margin-left: auto;
    box-shadow: 0 4px 15px rgba(0,123,255,0.3);
    border-bottom-right-radius: 8px;
}

.bot-message {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    color: #333;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    white-space: pre-wrap;
    word-wrap: break-word;
    border-bottom-left-radius: 8px;
}

.bot-message p {
    margin: 0 0 10px 0;
}

.bot-message p:last-child {
    margin-bottom: 0;
}

.loading {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* Input area */
.input-area {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: clamp(14px, 2.5vw, 16px);
    outline: none;
    transition: all 0.3s ease;
    resize: none;
    min-height: 50px;
    max-height: 120px;
}

#messageInput:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.15);
}

#sendButton {
    padding: 15px 25px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: clamp(14px, 2.5vw, 16px);
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 80px;
    height: 50px;
}

#sendButton:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,123,255,0.4);
}

#sendButton:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Media container */
.media-container {
    flex: 0 0 400px;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: block;
}

.media-container.show {
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.media-title {
    font-size: clamp(16px, 3vw, 20px);
    font-weight: bold;
    margin-bottom: 15px;
    color: #007bff;
    text-align: center;
}

.media-description {
    font-size: clamp(12px, 2vw, 14px);
    color: #666;
    line-height: 1.5;
    text-align: center;
    margin-top: 15px;
}

/* Video player */
.video-player {
    width: 100%;
    height: 250px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: none;
}

/* Animation container */
.animation-container {
    width: 100%;
    height: 250px;
    border: 2px solid #007bff;
    border-radius: 12px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,123,255,0.2);
}

/* Animation keyframes */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rain {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes drop {
    0% { transform: translateY(-10px); }
    100% { transform: translateY(40px); }
}

@keyframes liquidMove {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(10px, -5px); }
    66% { transform: translate(-8px, 8px); }
}

@keyframes gasMove {
    0% { transform: translate(0, 0); }
    25% { transform: translate(15px, -10px); }
    50% { transform: translate(-12px, -15px); }
    75% { transform: translate(8px, 12px); }
    100% { transform: translate(0, 0); }
}

@keyframes orbit {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes photosynth {
    0%, 100% { background: #4caf50; }
    50% { background: #8bc34a; }
}

/* Tablet Responsive (768px - 1024px) */
@media (max-width: 1024px) {
    body {
        padding: 15px;
    }
    
    .main-container {
        gap: 15px;
        height: calc(100vh - 30px);
    }
    
    .media-container {
        flex: 0 0 350px;
    }
    
    .animation-container,
    .video-player {
        height: 220px;
    }
    
    .chat-container,
    .media-container {
        padding: 15px;
    }
}

/* Mobile Responsive (up to 768px) */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .main-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 20px);
        gap: 15px;
    }
    
    .media-container {
        flex: none;
        order: -1;
        margin-bottom: 0;
        max-width: 100%;
    }
    
    .chat-container {
        min-height: 400px;
        flex: 1;
    }
    
    .animation-container,
    .video-player {
        height: 200px;
    }
    
    .input-area {
        gap: 10px;
    }
    
    #messageInput {
        padding: 12px 16px;
        min-height: 45px;
    }
    
    #sendButton {
        padding: 12px 20px;
        height: 45px;
        min-width: 70px;
    }
    
    .message {
        max-width: 90%;
        padding: 12px 16px;
    }
}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .main-container {
        gap: 10px;
    }
    
    .chat-container,
    .media-container {
        padding: 12px;
        border-radius: 12px;
    }
    
    .chat-container h1 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .messages {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .animation-container,
    .video-player {
        height: 180px;
    }
    
    .input-area {
        gap: 8px;
    }
    
    #messageInput {
        padding: 10px 14px;
        min-height: 40px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    #sendButton {
        padding: 10px 16px;
        height: 40px;
        min-width: 60px;
        font-size: 14px;
    }
    
    .message {
        max-width: 95%;
        padding: 10px 14px;
        margin-bottom: 15px;
    }
    
    .media-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .media-description {
        font-size: 12px;
        margin-top: 12px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .main-container {
        flex-direction: row;
        height: calc(100vh - 20px);
    }
    
    .media-container {
        flex: 0 0 300px;
        order: 0;
    }
    
    .chat-container {
        flex: 1;
    }
    
    .animation-container,
    .video-player {
        height: 160px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    #sendButton:hover {
        transform: none;
    }
    
    #sendButton:active {
        transform: scale(0.98);
    }
    
    .message {
        user-select: text;
        -webkit-user-select: text;
    }
    
    #messageInput {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Print styles */
@media print {
    .media-container,
    .input-area {
        display: none;
    }
    
    .chat-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Add this CSS to your existing styles.css file */

/* Login Screen Styles */
.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.auth-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.auth-header h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.auth-header p {
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.auth-form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

.auth-btn:hover {
    background: #5a6fd8;
}

.auth-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 10px;
    padding: 10px;
    background: #ffeaea;
    border-radius: 5px;
    border-left: 4px solid #e74c3c;
}

.btn-loading {
    color: #999;
}

/* Main App Styles (basic) */
.main-app {
    min-height: 100vh;
    background: #f5f5f5;
}

.app-nav {
    background: white;
    padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h2 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    text-align: right;
}

.user-name {
    display: block;
    font-weight: 600;
    color: #333;
}

.user-role {
    display: block;
    font-size: 12px;
    color: #666;
}

.nav-actions {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: none;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.nav-btn:hover {
    background: #f0f0f0;
}

.nav-btn.logout {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.nav-btn.logout:hover {
    background: #c0392b;
}

/* Tab Navigation */
.tab-navigation {
    background: white;
    border-bottom: 1px solid #ddd;
}

.tabs {
    display: flex;
    gap: 0;
}

.tab-btn {
    padding: 15px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: #f8f9fa;
}

/* Main Content */
.main-content {
    padding: 20px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Chat Styles */
.main-container {
    display: flex;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.chat-container {
    flex: 1;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.chat-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.chat-header h3 {
    margin: 0;
    color: #333;
}

.chat-info {
    color: #666;
    font-size: 12px;
    margin-top: 5px;
}

.messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 10px;
    max-height: 400px;
}

.message {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 10px;
    max-width: 80%;
    word-wrap: break-word;
}

.user-message {
    background: #667eea;
    color: white;
    margin-left: auto;
    text-align: right;
}

.bot-message {
    background: #f1f3f5;
    color: #333;
    margin-right: auto;
}

.error-message {
    background: #ffeaea !important;
    color: #e74c3c !important;
    border: 1px solid #e74c3c;
}

.input-area {
    display: flex;
    gap: 10px;
}

.input-area input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    font-size: 14px;
}

.input-area input:focus {
    outline: none;
    border-color: #667eea;
}

.input-area button {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.input-area button:hover {
    background: #5a6fd8;
}

.input-area button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Media Container */
.media-container {
    flex: 0 0 300px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-height: 600px;
}

.media-title {
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.video-player {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 15px;
}

.animation-container {
    margin-bottom: 15px;
    min-height: 200px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-description {
    font-size: 14px;
    color: #666;
    text-align: center;
    line-height: 1.4;
}

/* Content Headers */
.content-header {
    margin-bottom: 20px;
}

.content-header h3 {
    color: #333;
    margin: 0;
}

/* Loading and Placeholder Styles */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .media-container {
        flex: none;
    }
    
    .auth-container {
        padding: 30px 20px;
    }
    
    .tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .tab-btn {
        min-width: 120px;
    }
}

/* ========================================
   📱 ADVANCED MOBILE IMPROVEMENTS
   ======================================== */

/* Login Screen Mobile Fix */
@media (max-width: 480px) {
    .auth-screen {
        padding: 20px;
    }
    
    .auth-container {
        padding: 25px 20px;
        width: 100%;
        margin: 0;
    }
    
    .auth-header h1 {
        font-size: 20px;
    }
    
    .auth-header p {
        font-size: 13px;
    }
    
    /* ✅ Login formundaki inputlar */
    .form-group input {
        font-size: 16px !important; /* Prevents iOS zoom */
    }
}

/* Tab Navigation Improvements */
@media (max-width: 768px) {
    .tab-navigation {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .tab-navigation::-webkit-scrollbar {
        display: none;
    }
    
    .tabs {
        display: flex;
        flex-wrap: nowrap;
        min-width: min-content;
        padding: 0 10px;
    }
    
    .tab-btn {
        padding: 12px 16px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Chat Container Mobile Improvements */
@media (max-width: 768px) {
    .chat-container {
        max-height: none;
        min-height: 400px;
        height: auto;
    }
    
    .messages {
        max-height: 300px;
        padding: 15px 10px;
    }
    
    .message {
        font-size: 14px;
        padding: 10px 14px;
        max-width: 85%;
        -webkit-user-select: text;
        user-select: text;
    }
}

/* Input Area Touch Optimization - DÜZELTİLDİ */
@media (max-width: 768px) {
    .input-area {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 10px;
        margin: -20px;
        margin-top: 10px;
        border-top: 1px solid #e1e1e1;
    }
    
    /* ✅ Textarea için özel stil */
    #messageInput {
        font-size: 16px !important; /* Prevents iOS zoom */
        -webkit-appearance: none;
        border-radius: 8px;
    }
    
    #sendButton {
        min-width: 70px;
        font-size: 14px;
        min-height: 44px;
    }
}

/* Media Container Mobile */
@media (max-width: 768px) {
    .media-container {
        max-height: none;
        margin-bottom: 15px;
    }
    
    .video-player {
        height: 200px;
    }
    
    .animation-container {
        min-height: 180px;
    }
}

/* Touch-Friendly Buttons */
@media (hover: none) and (pointer: coarse) {
    button,
    .tab-btn,
    .auth-btn,
    .nav-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    button:hover,
    .tab-btn:hover,
    .auth-btn:hover {
        transform: none;
    }
    
    button:active,
    .tab-btn:active,
    .auth-btn:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* Navigation Mobile */
@media (max-width: 768px) {
    .app-nav {
        padding: 12px 15px;
        flex-wrap: wrap;
    }
    
    .nav-brand h2 {
        font-size: 16px;
    }
    
    .user-info {
        font-size: 11px;
    }
    
    .nav-actions {
        gap: 8px;
    }
    
    .nav-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .nav-brand h2 {
        font-size: 14px;
    }
    
    .user-info {
        display: none;
    }
    
    .nav-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
}

/* Landscape Mode Optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-container {
        max-height: 80vh;
    }
    
    .messages {
        max-height: 250px;
    }
}

/* iOS Safari Fixes */
@supports (-webkit-touch-callout: none) {
    input,
    textarea,
    select {
        font-size: 16px !important;
    }
    
    .input-area {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

/* Smooth scrolling for mobile */
@media (max-width: 768px) {
    .messages,
    .tab-navigation {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }
}

/* Loading and Error Mobile */
@media (max-width: 768px) {
    .loading {
        padding: 20px;
        font-size: 14px;
    }
    
    .error-message {
        font-size: 13px;
        padding: 8px;
        margin-top: 8px;
    }
}

/* Navigation Logo */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo {
    width: 40px;
    height: 40px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .nav-logo {
        width: 32px;
        height: 32px;
    }
}

/* The End */