/* OrgFarm Vibes - Modern Web UI Styles */

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

:root {
    --primary-color: #663399;
    --primary-hover: #552288;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --error-color: #dc3545;
    --background: #ffffff;
    --surface: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --spacing: 1rem;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--spacing);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Login Screen */
.login-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.login-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.login-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.login-screen-button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
    width: 100%;
    max-width: 300px;
}

.login-screen-button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.login-screen-button:active {
    transform: translateY(0);
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: var(--spacing);
    box-shadow: var(--shadow);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-content {
    text-align: center;
    flex: 1;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.user-profile {
    position: relative;
}

.user-profile-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    font-family: var(--font-family);
}

.user-profile-button:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.user-initials {
    text-transform: uppercase;
    line-height: 1;
}

.user-profile-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 250px;
    z-index: 1000;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.user-profile-header {
    padding: 1rem 1.25rem;
    background: var(--surface);
}

.user-profile-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.user-profile-email {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.user-profile-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.user-profile-logout {
    width: 100%;
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: var(--font-family);
    transition: background 0.2s;
}

.user-profile-logout:hover {
    background: var(--surface);
}

.user-profile-logout:active {
    background: #e9ecef;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-auth {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.auth-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.login-button,
.logout-button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
}

.login-button {
    background: var(--primary-color);
    color: white;
}

.login-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.logout-button {
    background: var(--secondary-color);
    color: white;
}

.logout-button:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .header-auth {
        width: 100%;
        justify-content: center;
    }
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 2.5rem;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    overflow: hidden;
}

/* Messages */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing);
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 4px;
}

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

.messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.message {
    display: flex;
    gap: var(--spacing);
    animation: fadeIn 0.3s ease-in;
}

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

.message-user {
    justify-content: flex-end;
}

.message-user .message-content {
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm) var(--radius-sm) 0 var(--radius-sm);
}

.message-system .message-content {
    background: var(--surface);
    border: 1px solid var(--border-color);
}

.message-assistant .message-content {
    background: var(--surface);
    border: 1px solid var(--border-color);
}

.message-error .message-content {
    background: #fff5f5;
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.message-assistant .message-content.message-prompt {
    background: #fff9e6;
    border: 1px solid #ffc107;
}

.message-assistant .message-content .prompt-message {
    background: transparent;
}

.message-content {
    max-width: 75%;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    word-wrap: break-word;
}

.message-content p {
    margin-bottom: 0.5rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.message-content code {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
}

.message-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.message-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-icon.success {
    background: var(--success-color);
}

.status-icon.error {
    background: var(--error-color);
}

.status-icon.prompt {
    background: #ffc107;
}

/* Prompt message styles */
.prompt-message {
    margin: 0;
}

.prompt-message p {
    margin-bottom: 0.75rem;
}

.prompt-options {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.prompt-options p {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.prompt-options-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.prompt-option {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.prompt-option:last-child {
    margin-bottom: 0;
}

.prompt-option strong {
    color: var(--primary-color);
    display: inline-block;
    margin-right: 0.5rem;
    min-width: 80px;
}

.prompt-parameter {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.prompt-parameter p {
    margin-bottom: 0.5rem;
}

.prompt-parameter code {
    background: rgba(255, 193, 7, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.suggestions-list {
    list-style: none;
    margin-top: 0.75rem;
    padding-left: 0;
}

.suggestions-list li {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.suggestions-list li:hover {
    background: var(--surface);
    border-color: var(--primary-color);
    transform: translateX(4px);
}

/* Input Container */
.input-container {
    border-top: 1px solid var(--border-color);
    padding: var(--spacing);
    background: white;
}

.input-wrapper {
    display: flex;
    gap: var(--spacing);
    align-items: flex-end;
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.75rem;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 51, 153, 0.1);
}

.message-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-family);
    font-size: 1rem;
    resize: none;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.5;
}

.message-input::placeholder {
    color: var(--text-secondary);
}

.send-button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.send-button:active:not(:disabled) {
    transform: scale(0.95);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-footer {
    margin-top: 0.5rem;
    text-align: center;
}

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

/* Loading indicator */
.loading {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
}

.loading-dot {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

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

    .header {
        padding: 1.5rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .chat-container {
        height: calc(100vh - 150px);
        min-height: 500px;
    }

    .message-content {
        max-width: 85%;
    }
}

/* Org Card Styles */
.org-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.org-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--surface);
}

.org-card-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
}

.org-status-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.org-status-trial {
    background: #e3f2fd;
    color: #1976d2;
}

.org-status-ready {
    background: #e8f5e9;
    color: #388e3c;
}

.org-status-owned {
    background: #fff3e0;
    color: #f57c00;
}

.org-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.org-info-section {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.org-info-section h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.org-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.org-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.org-info-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.org-info-value {
    font-size: 1rem;
    color: var(--text-primary);
    word-break: break-word;
}

.org-info-value code {
    background: rgba(102, 51, 153, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.org-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.org-action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
    border: 2px solid transparent;
    cursor: pointer;
}

.org-action-primary {
    background: var(--primary-color);
    color: white;
}

.org-action-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.org-action-secondary {
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.org-action-secondary:hover {
    background: var(--surface);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.org-action-button span {
    font-size: 1.2rem;
}

/* List Response Styles */
.list-response {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1rem 0;
}

.response-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
}

.list-item-org {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-color);
}

.list-item-org:last-child {
    margin-bottom: 0;
}

.inline-link {
    margin-left: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.inline-link:hover {
    text-decoration: underline;
}

/* Object Response Styles */
.object-response {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1rem 0;
}

.response-dl {
    display: grid;
    gap: 1rem;
    margin: 0;
}

.response-dl dt {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.response-dl dd {
    margin: 0 0 0 1.5rem;
    color: var(--text-primary);
}

.response-dl dd pre {
    background: var(--surface);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 0.5rem 0;
}

