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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

.token-input-group input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.token-input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-success {
    background: #38a169;
    color: white;
}

.main-content {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 400px;
    flex-shrink: 0;
}

.right-column {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.right-column .card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
}

.card-header {
    margin-bottom: 16px;
}

.card-footer {
    margin-top: 16px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
}

.pagination-btn {
    padding: 10px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #4a5568;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

.pagination-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    min-width: 80px;
    text-align: center;
}

.pagination-separator {
    color: #718096;
    font-weight: 400;
}

.pagination-size {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-size label {
    font-size: 14px;
    color: #718096;
    font-weight: 500;
}

.pagination-size select {
    padding: 8px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #4a5568;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.pagination-size select:hover {
    border-color: #667eea;
}

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

@media (max-width: 768px) {
    .pagination {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px;
    }
    
    .pagination-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .pagination-info {
        font-size: 14px;
    }
    
    .pagination-size {
        width: 100%;
        justify-content: center;
    }
}

.select-all {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.instance-count {
    margin-left: auto;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    background: #e2e8f0;
    padding: 6px 12px;
    border-radius: 16px;
}

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .left-column {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .left-column > .card {
        flex: 1;
        min-width: 300px;
    }
}

@media (max-width: 768px) {
    .left-column {
        flex-direction: column;
    }
    
    .left-column > .card {
        min-width: 100%;
    }
}

.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #4a5568;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.response-area {
    background: #1a202c;
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.response-area pre {
    color: #a0aec0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-all;
}

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

.response-header h3 {
    color: #718096;
    font-size: 14px;
}

.instance-list {
    flex: 1;
    overflow-y: auto;
    margin: 16px 0;
    padding-right: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.instance-list::-webkit-scrollbar {
    width: 6px;
}

.instance-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.instance-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.instance-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.instance-list-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.instance-item-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s ease;
}

.instance-item-row:hover {
    background: #f8fafc;
}

.instance-item-row:last-child {
    border-bottom: none;
}

.instance-item-row.running {
    background: rgba(56, 161, 105, 0.05);
}

.instance-item-row.stopped {
    background: rgba(229, 62, 62, 0.05);
}

.instance-item-row.pending {
    background: rgba(254, 252, 191, 0.1);
}

.btn.small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    font-weight: 500;
}

.btn.btn-warning {
    background: #ed8936;
    color: white;
}

.btn.btn-warning:hover {
    background: #dd6b20;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-running {
    background: #c6f6d5;
    color: #22543d;
}

.status-stopped {
    background: #fed7d7;
    color: #742a2a;
}

.status-pending {
    background: #fefcbf;
    color: #744210;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #718096;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

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

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast-success {
    background: #38a169;
}

.toast-error {
    background: #e53e3e;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.full-width {
    grid-column: 1 / -1;
}

.help-text {
    font-size: 12px;
    color: #718096;
    margin-top: 4px;
}

.divider {
    height: 1px;
    background: #e2e8f0;
    margin: 20px 0;
}
