/* Navbar Responsive Styles */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-menu {
    background-color: white;
    padding: 0.5rem;
}

.navbar-menu.is-active {
    position: absolute;
    width: 100%;
    box-shadow: 0 8px 16px rgba(10,10,10,.1);
}

@media screen and (max-width: 1023px) {
    .navbar-menu.is-active {
        animation: slideIn 0.3s ease-out;
    }
    
    .field.is-grouped-multiline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .field.is-grouped-multiline .control {
        margin-bottom: 0.5rem;
        width: 100%;
    }
    
    .field.is-grouped-multiline .button,
    .field.is-grouped-multiline .select {
        width: 100%;
    }
    
    .navbar-item {
        padding: 1rem;
        border-bottom: 1px solid #f5f5f5;
    }

    .navbar-item:last-child {
        border-bottom: none;
    }

    .navbar-brand {
        padding: 0.5rem;
    }

    body {
        padding-top: 3.25rem;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* RTL Support */
html[dir="rtl"] .navbar-start {
    margin-right: unset;
    margin-left: auto;
}

html[dir="rtl"] .navbar-end {
    margin-left: unset;
    margin-right: auto;
}

/* Chat Interface */
.chat-messages {
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    padding: 0.75rem;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 0.75rem;
    max-width: 85%;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

@media screen and (max-width: 768px) {
    .chat-messages {
        max-height: calc(100vh - 200px);
        padding: 0.5rem;
    }
    
    .chat-message {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        max-width: 90%;
    }
}

.user-message {
    background-color: #f5f5f5;
    margin-right: auto;
    margin-left: 3rem;
}

.ai-message {
    background-color: #f5f5f5;
    color: inherit;
    margin-left: auto;
    margin-right: 3rem;
}

.ai-message a {
    color: inherit;
    text-decoration: underline;
}

.system-message {
    background-color: #fafafa;
    border: 1px solid #dbdbdb;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
    color: #4a4a4a;
    font-size: 0.9em;
    line-height: 1.6;
}

.system-message strong {
    color: #363636;
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1em;
}

.system-message .timestamp {
    color: #666;
    font-weight: normal;
    background-color: #f5f5f5;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    margin: 0 0.2em;
    font-family: monospace;
}

/* Debug Panel */
.debug-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #f5f5f5;
    border-top: 2px solid #dbdbdb;
    max-height: 200px;
    overflow-y: auto;
    z-index: 30;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.9rem;
    display: none;
}

.debug-content {
    white-space: pre-wrap;
    word-break: break-word;
}

/* Settings Modal */
.settings-form .field:not(:last-child) {
    margin-bottom: 2rem;
}

.settings-form .subtitle {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dbdbdb;
}

.settings-form .checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-form .checkbox input[type="checkbox"] {
    margin-right: 0.5rem;
}

html[dir="rtl"] .settings-form .checkbox input[type="checkbox"] {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* Animations */
.fade-enter {
    opacity: 0;
}

.fade-enter-active {
    opacity: 1;
    transition: opacity 200ms ease-in;
}

.fade-exit {
    opacity: 1;
}

.fade-exit-active {
    opacity: 0;
    transition: opacity 200ms ease-out;
}

/* Utility Classes */
.is-hidden {
    display: none !important;
}

.cursor-pointer {
    cursor: pointer;
}

/* Log Entries */
.log-entry {
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

.log-entry .timestamp {
    color: #666;
    margin-right: 0.5rem;
}

/* Provider Status */
.provider-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-indicator.configured {
    background-color: #48c774;
}

.status-indicator.not-configured {
    background-color: #f14668;
}

/* Test Results */
.test-result {
    margin-bottom: 1rem;
}

.test-result pre {
    margin-top: 0.5rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Modal Customization */
.modal-card {
    max-height: 90vh;
    width: min(90%, 600px);
    margin: 0 auto;
}

.modal-card-head {
    background-color: #f5f5f5;
    padding: 1.25rem;
    min-height: 3.5rem;
}

.modal-card-body {
    max-height: calc(90vh - 130px);
    overflow-y: auto;
    padding: 1.5rem;
}

@media screen and (max-width: 768px) {
    .modal-card {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-card-head {
        padding: 1rem;
    }
    
    .modal-card-body {
        padding: 1.25rem;
    }
}

.modal-card-foot {
    justify-content: flex-end;
    background-color: #f5f5f5;
}

/* Responsive Adjustments */
@media screen and (max-width: 768px) {
    .field.is-grouped {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .field.is-grouped > .control {
        flex: 1 1 100%;
        min-width: 200px;
    }

    .field.is-grouped > .control .button,
    .field.is-grouped > .control .input,
    .field.is-grouped > .control .select {
        width: 100%;
        min-height: 2.75rem;
    }

    .debug-panel {
        max-height: 120px;
        font-size: 0.85rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .button, 
    .navbar-item,
    .select select,
    input[type="checkbox"] {
        min-height: 44px;
    }

    .navbar-menu.is-active .navbar-item {
        padding: 1rem 1.5rem;
    }

    .modal-card-foot .button {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .buttons,
    .modal,
    .debug-panel {
        display: none !important;
    }

    .container {
        max-width: none !important;
        padding: 0 !important;
    }

    pre {
        white-space: pre-wrap !important;
        word-break: break-word !important;
    }
}
