/* Authentication Styles */

/* API Button */
.api-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 12px;
}

.api-btn:hover {
    background: var(--accent);
    border-color: var(--muted-foreground);
}

/* Login Button */
.login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

/* User Menu */
.user-menu-container {
    position: relative;
}

.user-menu-dropdown {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--foreground);
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu-trigger:hover {
    background: var(--accent);
}

.user-avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown-content {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.user-dropdown-content.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--foreground);
    text-decoration: none;
    border-radius: calc(var(--radius) - 2px);
    transition: all 0.2s;
    font-size: 14px;
}

.dropdown-item:hover {
    background: var(--accent);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

/* Auth Modal */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.auth-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 420px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    animation: slideUp 0.3s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.auth-modal-content.small {
    max-width: 380px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    font-size: 18px;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--accent);
    color: var(--foreground);
}

.auth-container {
    text-align: center;
}

.auth-header {
    margin-bottom: 24px;
    text-align: center;
}

.auth-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 6px;
}

.auth-header p {
    font-size: 13px;
    color: var(--muted-foreground);
    line-height: 1.5;
}

/* Form Styles */
.auth-form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input.error {
    border-color: #ef4444;
}

.error-message {
    display: none;
    margin-top: 4px;
    font-size: 12px;
    color: #ef4444;
}

.error-message.show {
    display: block;
}

.btn-primary {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 24px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    animation: successPulse 0.5s ease;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.auth-links {
    text-align: center;
    margin-top: 16px;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.auth-links a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.auth-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 14px;
    color: var(--muted-foreground);
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    margin-left: 4px;
    font-weight: 500;
}

.auth-footer a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Success/Error Messages */
.alert {
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: var(--radius);
    font-size: 14px;
}

.alert-success {
    background: #f0fdf4;
    color: #14532d;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

body.dark .alert-success {
    background: #14532d;
    color: #bbf7d0;
    border: 1px solid #166534;
}

body.dark .alert-error {
    background: #7f1d1d;
    color: #fecaca;
    border: 1px solid #991b1b;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .auth-modal-content {
        width: 95%;
        padding: 30px 20px;
    }

    .user-menu-trigger .user-name {
        display: none;
    }

    .user-dropdown-content {
        right: -50px;
    }
}

/* API Modal Button Styles */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-secondary {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    color: var(--foreground);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-secondary:hover {
    border-color: #667eea;
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-primary {
    flex: 1;
    margin-top: 0 !important;
}

.btn-danger-text {
    background: transparent;
    color: #ef4444;
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--radius);
}

.btn-danger-text:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    text-decoration: underline;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: var(--radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--foreground);
}

.btn-icon:hover {
    background: var(--accent);
    border-color: var(--accent-foreground);
    transform: scale(1.05);
}

/* Input with button */
.input-with-button {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-button input {
    flex: 1;
    padding-right: 40px;
}

.input-with-button .btn-icon {
    position: absolute;
    right: 8px;
    padding: 6px;
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.input-with-button .btn-icon:hover {
    background: var(--accent);
    color: var(--foreground);
}

/* API Status Styles */
.api-status {
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 20px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

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

.status-label {
    font-size: 14px;
    color: var(--muted-foreground);
}

.status-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--foreground);
}

.status-value.connected {
    color: #10b981;
}

.status-value.disconnected {
    color: #ef4444;
}

/* API Actions */
.api-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.api-actions button {
    flex: 1;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.api-actions .btn-secondary {
    background: var(--accent);
    border: 1px solid var(--border);
    color: var(--foreground);
}

.api-actions .btn-secondary:hover:not(:disabled) {
    background: var(--muted);
}

.api-actions .btn-primary {
    background: var(--foreground);
    color: var(--background);
    border: 1px solid var(--foreground);
}

.api-actions .btn-primary:hover:not(:disabled) {
    opacity: 0.9;
}

.api-actions .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.api-actions .btn-primary.btn-success {
    background: #10b981;
    border-color: #10b981;
}

/* Test Result */
.test-result,
.api-test-result {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    animation: slideUp 0.2s ease;
}

.api-test-result.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.api-test-result.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

.result-content,
.test-result-content {
    font-size: 13px;
    line-height: 1.5;
}

.result-message {
    color: var(--foreground);
}

.api-test-result.success .result-message {
    color: #10b981;
}

.api-test-result.error .result-message {
    color: #ef4444;
}

/* API Models Info */
.api-models-info {
    margin-bottom: 20px;
}

.model-info-card {
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.model-badge {
    display: inline-flex;
    align-items: center;
    background: #ff6b6b;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.model-info-card strong {
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
}

.model-info-card small {
    color: var(--muted-foreground);
    font-size: 12px;
    margin-left: auto;
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted-foreground);
}

.field-hint a {
    color: #ff6b6b;
    text-decoration: none;
    font-size: 12px;
    transition: opacity 0.2s ease;
}

.field-hint a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Loading state for buttons */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-radius: 50%;
    border-top-color: currentColor;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Dark mode adjustments */
body.dark .btn-secondary {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

body.dark .btn-secondary:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

body.dark .model-info-card {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark .api-status {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark .test-result {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}