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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Container and layout */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    width: 100%;
}

/* Authentication */
.login-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    min-width: 300px;
}

.login-form h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
}

.login-form input {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
}

.login-form button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.login-form button:hover {
    background: #5a6fd8;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #ddd;
    margin-bottom: 2rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-connected { color: #28a745; }
.status-disconnected { color: #6c757d; }
.status-reconnecting { color: #ffc107; }
.status-error { color: #dc3545; }

/* Content input section */
.content-input-section {
    margin-bottom: 2rem;
}

.input-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#content-input {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    resize: vertical;
    font-family: inherit;
}

#content-input:focus {
    outline: none;
    border-color: #667eea;
}

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    gap: 1rem;
}

.primary-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.primary-btn:hover {
    background: #5a6fd8;
}

.secondary-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.secondary-btn:hover {
    background: #5a6268;
}

.char-counter {
    font-size: 14px;
    color: #6c757d;
}

.char-counter.warning {
    color: #dc3545;
    font-weight: bold;
}

/* Content history */
.content-history-section {
    flex: 1;
}

.content-history-section h2 {
    margin-bottom: 1rem;
}

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

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

.toast {
    background: #333;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 10px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast-success { background: #28a745; }
.toast-error { background: #dc3545; }
.toast-warning { background: #ffc107; color: #333; }
.toast-info { background: #17a2b8; }

/* Error messages */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    border: 1px solid #f5c6cb;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-container {
        padding: 0.5rem;
    }

    .app-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .input-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .auth-container {
        padding: 1rem;
    }

    .login-form {
        min-width: auto;
        width: 100%;
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    #content-input {
        min-height: 100px;
    }
}